Skip to content

feat(install): enable systemd-boot for ostree backend#2099

Open
andrewdunndev wants to merge 1 commit intobootc-dev:mainfrom
andrewdunndev:feat/ostree-systemd-boot
Open

feat(install): enable systemd-boot for ostree backend#2099
andrewdunndev wants to merge 1 commit intobootc-dev:mainfrom
andrewdunndev:feat/ostree-systemd-boot

Conversation

@andrewdunndev
Copy link
Contributor

Replace the bail!("bootupd is required for ostree-based installs") with working systemd-boot support for the ostree backend. The approach keeps ostree's ext4 /boot for its internal management, then copies BLS entries and kernel artifacts to the FAT32 ESP where systemd-boot can read them.

Changes

baseline.rs: Force a /boot partition when Bootloader::Systemd + non-composefs. Format it as ext4 (ostree needs POSIX fs for hardlinks/symlinks).

install.rs: Set sysroot.bootprefix=false for systemd-boot so BLS paths are relative to /boot root, not prefixed with /boot/. Replace the bail with install_systemd_boot() + sync_boot_to_esp().

bootloader.rs: New sync_boot_to_esp() function (~100 lines) that mounts the ESP, reads BLS entries from /boot/loader/entries/, and copies .conf files + referenced kernel + initrd to the ESP.

Partition layout

p1: 1M    BIOS boot
p2: 512M  ESP (FAT32) -- systemd-boot EFI binary + BLS entries + kernel/initrd
p3: 510M  /boot (ext4) -- ostree internal (hardlinks, symlinks, atomic swaps)
p4: rest  root (XFS)

Test results

GCP n2-standard-8, nested KVM, Fedora 42, QEMU + OVMF 4M:

Test Result
Partition layout (BIOS + ESP + ext4 /boot + XFS root) PASS
BLS entries with bootprefix=false PASS
BLS + kernel + initrd copied to ESP PASS
systemd-boot v257.11 boots system PASS
ostree deployment active PASS
bootc status correct (store=ostreeContainer) PASS
kargs.d entries in /proc/cmdline PASS
systemd-networkd working PASS

Scope

This covers install-time support only. See #2098 for discussion of the upgrade-time ESP sync -- ostree staging does not write BLS entries to /boot until the next boot (ostree-finalize-staged.service), so the upgrade path needs a different approach.

Relates to #2098, #92

@bootc-bot bootc-bot bot requested a review from jmarrero March 26, 2026 17:42
@github-actions github-actions bot added the area/install Issues related to `bootc install` label Mar 26, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables systemd-boot support for ostree-based installations by implementing a synchronization mechanism that copies boot artifacts from the ext4 /boot partition to the FAT32 ESP. Key changes include the addition of sync_boot_to_esp to manage BLS entries and kernel files, ensuring /boot is formatted as ext4 for POSIX compatibility, and configuring ostree with sysroot.bootprefix=false. Review feedback recommends enhancing the robustness of the BLS configuration parser to handle complex values and simplifying path expressions in the installation logic to reduce unnecessary cloning.

@andrewdunndev andrewdunndev force-pushed the feat/ostree-systemd-boot branch from 68ca265 to 8b06e22 Compare March 26, 2026 18:35
Replace the bail!("bootupd is required for ostree-based installs") with
working systemd-boot support for the ostree backend. The approach keeps
ostree's ext4 /boot for its internal hardlink/symlink management, then
copies BLS entries and kernel artifacts to the FAT32 ESP where
systemd-boot can read them.

Three changes:
- baseline.rs: force ext4 /boot partition for systemd-boot + ostree
- install.rs: set sysroot.bootprefix=false, replace bail with
  install_systemd_boot() + sync_boot_to_esp()
- bootloader.rs: new sync_boot_to_esp() function that copies BLS
  entries, kernel, and initrd from /boot to the ESP

Tested on Fedora 42 with QEMU + OVMF: system boots with systemd-boot
v257, ostree deployment active, kargs.d entries in /proc/cmdline.

This covers install-time support. Upgrade-time ESP sync is a follow-up
because ostree staging does not write BLS entries to /boot until the
next boot (ostree-finalize-staged.service).

Signed-off-by: Andrew Dunn <andrew@dunn.dev>
@andrewdunndev andrewdunndev force-pushed the feat/ostree-systemd-boot branch from 8b06e22 to 9789cde Compare March 26, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant