Repository navigation
composefs: Replace a staged UKI's boot entries - #2630
Merged
Johan-Liebert1 merged 1 commit intoNov 11, 2026
Merged
Conversation
Johan-Liebert1
requested changes
Nov 10, 2026
Johan-Liebert1
left a comment
Member
There was a problem hiding this comment.
It'd be great to move the tmt test into the gc test
| } | ||
|
|
||
| BootSetupType::Upgrade((_, booted_cfs, ..)) => { | ||
| // An earlier staged deployment's entry may have another version in |
Member
There was a problem hiding this comment.
Hmm.. it'd be better to find a function lower on the stack where we do this, but that's more of a cleanup
Contributor
Author
There was a problem hiding this comment.
Agreed it'd be cleaner further down, I'd rather do that as a follow-up so this fix doesn't wait on it, if that's ok.
Staging a UKI wrote its entries into loader/entries.staged next to whatever an earlier staged deployment left there. An entry's file name carries the version from the UKI's os-release, so staging an image of another version over a staged one kept the earlier entry. Status then found a deployment that was neither staged nor rollback, garbage collection removed its image while its entry and state directory stayed, and from then on status failed to open the manifest. Upgrade, switch and finalization all go through status, so the system was stuck on the booted deployment, and rebooting didn't help. Remove the staged entries before writing the new ones, as setup_composefs_bls_boot() has done since bootc-dev#1861. Assisted-by: AI Signed-off-by: Kristof Imeri <kristof@lanth.me>
krissedout
force-pushed
the
composefs-staged-entries
branch
from
November 10, 2026 22:52
311c753 to
58f8074
Compare
Johan-Liebert1
approved these changes
Nov 11, 2026
krissedout
added a commit
to krissedout/bootc
that referenced
this pull request
Nov 11, 2026
setup_composefs_bls_boot() and write_systemd_uki_config() each had their own copy of writing a deployment's Type 1 entry: into loader/entries on install, or, when staging, into a fresh loader/entries.staged next to the booted deployment's entry. The UKI copy only started clearing the earlier staged entries in bootc-dev#2630, after the BLS one had done so since bootc-dev#1861. Move it into write_type1_entries(), which both now call, so the two can't drift apart again. It also fsyncs the entries directory it wrote to for UKIs too, where it used to fsync the ESP's root. Assisted-by: AI Signed-off-by: Kristof Imeri <kristof@lanth.me>
cgwalters
pushed a commit
that referenced
this pull request
Nov 13, 2026
setup_composefs_bls_boot() and write_systemd_uki_config() each had their own copy of writing a deployment's Type 1 entry: into loader/entries on install, or, when staging, into a fresh loader/entries.staged next to the booted deployment's entry. The UKI copy only started clearing the earlier staged entries in #2630, after the BLS one had done so since #1861. Move it into write_type1_entries(), which both now call, so the two can't drift apart again. It also fsyncs the entries directory it wrote to for UKIs too, where it used to fsync the ESP's root. Assisted-by: AI Signed-off-by: Kristof Imeri <kristof@lanth.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Staging an update over one that's already staged, with a different version, leaves bootc status failing with "Opening OCI image for manifest sha256:...: No such file or directory". bootc upgrade and bootc switch fail with the same error, and a reboot doesn't help: it comes back on the old deployment with status still failing, so the machine can't take any more updates. This happens with UKIs under systemd-boot, for example when a timer stages a new build before anyone has rebooted into the last one.
A boot entry's file name carries the version from the UKI's os-release, and write_systemd_uki_config() adds to loader/entries.staged without clearing it, so the earlier staged entry stays next to the new one. Status then finds a deployment that's neither staged nor rollback, GC drops its image while the entry and state directory stay, and the next status can't open its manifest. #1857 reported the entries stacking up and #1861 fixed that for Type 1 entries with a kernel and initrd, but UKIs go through a different function. Images whose version doesn't change, like a stream of Fedora builds all with VERSION_ID=45, overwrite the same file name and never hit this.
This removes the staged entries before writing the new ones, the same way setup_composefs_bls_boot() does.
On this branch cargo fmt --check, cargo check --workspace --all-targets, cargo test -p bootc-lib -p bootc-internal-blockdev and just validate pass. There's no unit test because the function needs a booted deployment and a real bootloader, so the coverage is in test-composefs-gc-uki.nu: with systemd-boot, its last boot stages two images with different VERSION_IDs, then checks that loader/entries.staged only has the new and booted entries and that the replaced deployment's state is gone.
I ran it with an image from just build on fedora-bootc:45 (composefs, systemd-boot, unsealed UKI, ext4), with SELinux enforcing. On main it fails with three entries in loader/entries.staged, and status, upgrade and switch all fail with the error above, also after rebooting. With this change it passes through the reboot, and status, GC and bootc upgrade behave normally afterwards. I don't have bcvk or libvirt on this machine, so rather than through just test-tmt I installed with bootc install to-disk from a helper VM and ran the script stage by stage in qemu, with the fixed bootc bind-mounted over /usr/bin/bootc. I didn't run it on centos-bootc stream10 or with a sealed UKI.
Assisted-by: AI
I reviewed and tested the changes myself.