Skip to content

Commit 3aa40e6

Browse files
committed
install: skip mountspec kargs when passed empty rootspec
See #1441
1 parent 35ef25d commit 3aa40e6

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

crates/lib/src/install.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,7 @@ pub(crate) async fn install_to_filesystem(
18071807

18081808
// We support overriding the mount specification for root (i.e. LABEL vs UUID versus
18091809
// raw paths).
1810+
// We also support an empty specification as a signal to omit any mountspec kargs.
18101811
let root_info = if let Some(s) = fsopts.root_mount_spec {
18111812
RootMountInfo {
18121813
mount_spec: s.to_string(),
@@ -1903,12 +1904,20 @@ pub(crate) async fn install_to_filesystem(
19031904
// By default, we inject a boot= karg because things like FIPS compliance currently
19041905
// require checking in the initramfs.
19051906
let bootarg = boot.as_ref().map(|boot| format!("boot={}", &boot.source));
1906-
let kargs = [rootarg]
1907-
.into_iter()
1908-
.chain(root_info.kargs)
1909-
.chain([RW_KARG.to_string()])
1910-
.chain(bootarg)
1911-
.collect::<Vec<_>>();
1907+
1908+
// If the root mount spec is empty, we omit the mounts kargs entirely.
1909+
// https://github.com/bootc-dev/bootc/issues/1441
1910+
let mut kargs = if root_info.mount_spec.is_empty() {
1911+
Vec::new()
1912+
} else {
1913+
[rootarg]
1914+
.into_iter()
1915+
.chain(root_info.kargs)
1916+
.chain(bootarg)
1917+
.collect::<Vec<_>>()
1918+
};
1919+
1920+
kargs.push(RW_KARG.to_string());
19121921

19131922
let skip_finalize =
19141923
matches!(fsopts.replace, Some(ReplaceMode::Alongside)) || fsopts.skip_finalize;

0 commit comments

Comments
 (0)