Skip to content

switch: fix --apply not rebooting when already staged#2249

Open
jlebon wants to merge 3 commits into
bootc-dev:mainfrom
jlebon:pr/fix-apply-staged
Open

switch: fix --apply not rebooting when already staged#2249
jlebon wants to merge 3 commits into
bootc-dev:mainfrom
jlebon:pr/fix-apply-staged

Conversation

@jlebon

@jlebon jlebon commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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.

jlebon added 2 commits June 12, 2026 12:03
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>
@github-actions github-actions Bot added the area/documentation Updates to the documentation label Jun 12, 2026
@bootc-bot bootc-bot Bot requested a review from jeckersb June 12, 2026 17:02
# 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)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Johan-Liebert1
Johan-Liebert1 previously approved these changes Jun 15, 2026
@jlebon

jlebon commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Anything else on this one?

cgwalters
cgwalters previously approved these changes Jun 17, 2026
@cgwalters cgwalters added this pull request to the merge queue Jun 17, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 17, 2026
@Johan-Liebert1 Johan-Liebert1 added this pull request to the merge queue Jun 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jun 18, 2026
@cgwalters cgwalters added this pull request to the merge queue Jun 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 19, 2026
@jlebon

jlebon commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

OK there seems to be an inconsistency between the composefs and ostree backends. In ostree, the host.spec.image is considered to be the staged image first with fallback to the booted image. Whereas in the composefs backend, it always uses the booted image. I assume that's an oversight?

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>
@jlebon jlebon dismissed stale reviews from cgwalters and Johan-Liebert1 via 04360bd June 19, 2026 18:32
@jlebon

jlebon commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

In ostree, the host.spec.image is considered to be the staged image first with fallback to the booted image. Whereas in the composefs backend, it always uses the booted image.

Pushed a commit to fix the composefs backend now.

composefs passes locally now but would appreciate if someone could add the ci/merge label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Updates to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants