Repository navigation
composefs: Keep the boot entries' os_id on rollback - #2631
Merged
Johan-Liebert1 merged 1 commit intoNov 10, 2026
Merged
Conversation
A rollback rewrote both Type 1 entries with "bootc" as the os_id, so bootc_fedora-45-1.conf came back as bootc_bootc-45-1.conf with the sort key bootc-bootc-0, unlike every entry install, upgrade and switch write. Since the sort key changes too, the entries also move relative to anything else in the boot menu. Take the os_id from the sort keys the entries already have, so a rollback only swaps which one comes first. Entries with a sort key bootc didn't write still fall back to "bootc". 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.
After bootc rollback, both boot entries are renamed: bootc_fedora-45-1.conf with sort key bootc-fedora-0 comes back as bootc_bootc-45-1.conf with sort key bootc-bootc-0. Every install, upgrade and switch writes the distro's name, so the names change depending on whether the last operation was a rollback, and since the sort keys change too the entries can move relative to anything else in the boot menu, such as another OS's entries on the same ESP. They stay that way until the next upgrade rewrites them. The bootc_bootc entries in the table in #2224 look like this as well.
rollback_composefs_entries() hardcoded "bootc" as the os_id, with a TODO to get the real one. The entries already have it, so this reads it from their sort keys and a rollback only swaps which one comes first. An entry with a sort key bootc didn't write still falls back to "bootc", so nothing changes for those.
On this branch cargo fmt --check, cargo check --workspace --all-targets, cargo test -p bootc-lib -p bootc-internal-blockdev and just validate pass, including a table-driven test for reading the os_id out of a sort key. test-rollback now also checks on systemd-boot that the entries keep their name and sort keys across bootc rollback.
I ran test-rollback with an image from just build on fedora-bootc:45 (composefs, systemd-boot, unsealed UKI, ext4), with SELinux enforcing. On main the new check fails with bootc_bootc and bootc-bootc-0 where it expected bootc_fedora and bootc-fedora-0. With this change the whole test passes through its reboots and the entries end up as bootc_fedora-45-0.conf and bootc_fedora-45-1.conf. 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 with GRUB or with Type 1 entries with a kernel and initrd. They use the same function, but the new tmt check only runs on systemd-boot.
Assisted-by: AI
I reviewed and tested the changes myself.