Skip to content

Commit 8d51fbe

Browse files
henrywangcgwalters
authored andcommitted
composefs: Use systemd.mount-extra karg for /boot mount
The composefs install path was not ensuring /boot gets mounted after reboot on systems with a separate /boot partition (e.g. to-existing-root installs). This broke `bootc status` and `bootc upgrade`. Instead of writing to /etc/fstab (which conflicts with transient etc per #1388), add a systemd.mount-extra kernel argument to the BLS boot entry. This tells systemd to mount the boot partition without requiring any /etc state. Closes: #2120 Assisted-by: Claude Code (Opus 4.6) Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
1 parent 84e54ab commit 8d51fbe

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,22 @@ pub(crate) fn setup_composefs_bls_boot(
532532
ComposefsCmdline::build(&id_hex, state.composefs_options.allow_missing_verity);
533533
cmdline_options.extend(&Cmdline::from(&composefs_cmdline.to_string()));
534534

535+
// If there's a separate /boot partition, add a systemd.mount-extra
536+
// karg so systemd mounts it after reboot. This avoids writing to
537+
// /etc/fstab which conflicts with transient etc (see #1388).
538+
if let Some(boot) = root_setup.boot_mount_spec() {
539+
if !boot.source.is_empty() {
540+
let mount_extra = format!(
541+
"systemd.mount-extra={}:/boot:{}:{}",
542+
boot.source,
543+
boot.fstype,
544+
boot.options.as_deref().unwrap_or("defaults"),
545+
);
546+
cmdline_options.extend(&Cmdline::from(mount_extra.as_str()));
547+
tracing::debug!("Added /boot mount karg: {mount_extra}");
548+
}
549+
}
550+
535551
// Locate ESP partition device
536552
let esp_part = root_setup.device_info.find_partition_of_esp()?;
537553

crates/lib/src/install.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,11 @@ impl RootSetup {
13241324
self.boot.as_ref().map(require_boot_uuid).transpose()
13251325
}
13261326

1327+
/// Get the boot mount spec, if a separate /boot partition exists.
1328+
pub(crate) fn boot_mount_spec(&self) -> Option<&MountSpec> {
1329+
self.boot.as_ref()
1330+
}
1331+
13271332
// Drop any open file descriptors and return just the mount path and backing luks device, if any
13281333
#[cfg(feature = "install-to-disk")]
13291334
fn into_storage(self) -> (Utf8PathBuf, Option<String>) {

0 commit comments

Comments
 (0)