switch: fix --apply not rebooting when already staged#2249
Conversation
When 'bootc switch --apply' is called targeting an image that is already staged, the spec comparison short-circuits with 'Image specification is unchanged' and returns early without rebooting. This is the same class of bug that was fixed for 'bootc upgrade --apply' in commit 0067a47. Fix both the ostree and composefs switch paths. Full AI use (reproduced bug, patched bootc, verified bugfix). I verified the verification and the patch. Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
The tmt README instructions to `tmt run` directly just won't work without the bcvk wrappers. My agent got tripped up on this. That README overall looks pretty stock. Just keep it short and redirect to CONTRIBUTING.md. While we're there, also mention tmt and libvirt, which would've helped my agent. Very mild AI assistance. Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
| # Now, switch into the new image. First stage it, then run switch --apply for | ||
| # the same target. This exercises the case where --apply must still reboot for | ||
| # staged deployments. | ||
| print $"Staging ($imgsrc)" |
There was a problem hiding this comment.
We're technically losing coverage here on doing a one-shot switch --apply which both had to stage and reboot together.
It didn't feel worth adding another reboot to test this since it's trivial (while the early return reboot into staged here is a more subtle gotcha), but happy to do so if folks prefer.
|
Anything else on this one? |
|
OK there seems to be an inconsistency between the composefs and ostree backends. In ostree, the |
The ostree backend derives `host.spec.image` from the staged deployment first, falling back to booted. This ensures the spec reflects the desired state after a `bootc switch`. But the composefs backend on the other hand was only deriving it from the booted deployment, which meant the spec never reflected a staged switch. Fix the composefs logic to match the ostree one. Heavily AI-guided. Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
Pushed a commit to fix the composefs backend now. composefs passes locally now but would appreciate if someone could add the |
When
bootc switch --applyis called targeting an image that is alreadystaged, the spec comparison short-circuits with 'Image specification is
unchanged' and returns early without rebooting. This is the same class
of bug that was fixed for
bootc upgrade --applyin commit 0067a47.Fix both the ostree and composefs switch paths.
Full AI use (reproduced bug, patched bootc, verified bugfix). I verified
the verification and the patch.