Repository navigation
composefs: Keep BLS entries when a signed GRUB started the system - #2646
krissedout wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the composefs bootloader-detection change.
No open issues 🎉
What changed in this PR
This PR fixes composefs bootloader detection when a distribution’s signed GRUB starts a systemd-boot installation, preserving BLS entry handling so bootc commands do not look for nonexistent GRUB configuration.
Changes:
- Probe the filesystem for generic GRUB starts and use BLS-compatible handling when BLS entries exist without a GRUB directory.
- Document the fallback and add table-driven tests covering GRUB starts with and without a GRUB directory.
| File | Description |
|---|---|
crates/lib/src/bootc_composefs/status.rs |
Updates bootloader classification, filesystem probing, documentation, and regression tests. |
Review effort: Balanced
09af9ac to
6859d67
Compare
6859d67 to
efdb62a
Compare
Ugh. I agree we probably need to support it but holy cow is it confusing.
Wait I'm confused, shouldn't systemd-boot overwrite the |
Fair, I worded that badly. It's a system installed for systemd-boot, with its UKIs and Type 1 entries, but in our case there's a fallback firmware entry we use until shim trusts our key, and that start goes through Fedora's shim, GRUB and kernel instead. The GRUB config for it isn't under /boot and GRUB doesn't read the BLS entries, so bootc finds no GRUB directory and fails. The deployments and entries bootc manages are still the systemd-boot ones, which is why treating it as BLS-compatible is right there.
systemd-boot doesn't run at all on that path. The firmware starts shim, shim starts GRUB, and GRUB boots the kernel and initramfs itself from its own config on the ESP. So LoaderInfo is GRUB's because GRUB is the only loader that ran. I'll reword the description so it doesn't sound like GRUB chainloads systemd-boot. |
A system set up for systemd-boot, with its UKIs and Type 1 entries, can also be started without systemd-boot: for example from a fallback firmware entry that goes through a distribution's signed shim and GRUB, with GRUB booting the kernel and initramfs from its own configuration on the ESP, while shim doesn't trust the system's own key yet. GRUB is then the only loader that ran and names itself in LoaderInfo, and get_bootloader() took any LoaderInfo other than systemd-boot's or GRUB CC's for a GRUB system. bootc then looked for a GRUB configuration under /boot that doesn't exist, so bootc status failed on those starts, and with it upgrade, switch and rollback. For a generic GRUB, also probe the filesystem as the non-EFI case does, and treat the entries as BLS-compatible when /boot/loader/entries is a directory and there's no GRUB directory next to it. A GRUB that has its own directory is still classified as GRUB. Assisted-by: AI Signed-off-by: Kristof Imeri <kristof@lanth.me>
efdb62a to
5722c58
Compare
A system set up for systemd-boot, with its UKIs and Type 1 entries, can also be started without systemd-boot: for example from a fallback firmware entry that goes through a distribution’s signed shim and GRUB, with GRUB booting the kernel and initramfs from its own configuration on the ESP, while shim doesn’t trust the system’s own key yet. GRUB is then the only loader that ran and names itself in LoaderInfo, and get_bootloader() takes any LoaderInfo other than systemd-boot’s or GRUB CC’s for a GRUB system, so bootc looks for a GRUB configuration under /boot that doesn’t exist, and bootc status fails on those starts, along with upgrade, switch and rollback.
For a generic GRUB it now probes the filesystem the way the non-EFI case already does, and treats the entries as BLS-compatible when /boot/loader/entries exists and there's no GRUB directory next to it. A GRUB with its own directory is still GRUB. The classifier's table test has both cases.
Assisted-by: AI