diff --git a/crates/lib/src/install.rs b/crates/lib/src/install.rs index 2a18c45c2..4b391afb9 100644 --- a/crates/lib/src/install.rs +++ b/crates/lib/src/install.rs @@ -2053,6 +2053,24 @@ async fn install_to_filesystem_impl( } } else { ostree_install(state, rootfs, cleanup).await?; + + // For s390x, we set zipl as the bootloader + // this needs to be done after the ostree commit is deployed, + // as we don't want zipl to run during the initial ostree deployement. + if cfg!(target_arch = "s390x") { + Command::new("ostree") + .args([ + "config", + "--repo", + "ostree/repo", + "set", + "sysroot.bootloader", + "zipl", + ]) + .cwd_dir(rootfs.physical_root.try_clone()?) + .run_capture_stderr() + .context("Setting bootloader config to zipl")?; + } } // As the very last step before filesystem finalization, do a full SELinux diff --git a/crates/lib/src/install/baseline.rs b/crates/lib/src/install/baseline.rs index 8a32e98c9..cfd8878e1 100644 --- a/crates/lib/src/install/baseline.rs +++ b/crates/lib/src/install/baseline.rs @@ -484,7 +484,8 @@ pub(crate) fn install_create_rootfs( } } - bootc_mount::mount(&rootdev_path, &physical_root_path)?; + let fstype = &root_filesystem.to_string(); + bootc_mount::mount_typed(&rootdev_path, fstype, &physical_root_path)?; let target_rootfs = Dir::open_ambient_dir(&physical_root_path, cap_std::ambient_authority())?; crate::lsm::ensure_dir_labeled(&target_rootfs, "", Some("/".into()), 0o755.into(), sepolicy)?; let physical_root = Dir::open_ambient_dir(&physical_root_path, cap_std::ambient_authority())?; @@ -492,7 +493,7 @@ pub(crate) fn install_create_rootfs( // Create the underlying mount point directory, which should be labeled crate::lsm::ensure_dir_labeled(&target_rootfs, "boot", None, 0o755.into(), sepolicy)?; if let Some(bootdev) = bootdev { - bootc_mount::mount(&bootdev.path(), &bootfs)?; + bootc_mount::mount_typed(&bootdev.path(), fstype, &bootfs)?; } // And we want to label the root mount of /boot crate::lsm::ensure_dir_labeled(&target_rootfs, "boot", None, 0o755.into(), sepolicy)?; diff --git a/crates/mount/src/mount.rs b/crates/mount/src/mount.rs index 67eba4a68..c5f7eee16 100644 --- a/crates/mount/src/mount.rs +++ b/crates/mount/src/mount.rs @@ -145,6 +145,19 @@ pub fn mount(dev: &str, target: &Utf8Path) -> Result<()> { .run_inherited_with_cmd_context() } +/// Mount a device with an explicit filesystem type. +/// +/// This avoids relying on the `mount` utility's blkid auto-detection, +/// which can fail in certain container environments (e.g. when the +/// required filesystem kernel module is not yet loaded and the blkid +/// probe doesn't work, causing mount to fall back to iterating +/// `/etc/filesystems` and `/proc/filesystems`). +pub fn mount_typed(dev: &str, fstype: &str, target: &Utf8Path) -> Result<()> { + Command::new("mount") + .args(["-t", fstype, dev, target.as_str()]) + .run_inherited_with_cmd_context() +} + /// If the fsid of the passed path matches the fsid of the same path rooted /// at /proc/1/root, it is assumed that these are indeed the same mounted /// filesystem between container and host. diff --git a/tmt/tests/booted/readonly/052-test-bli-detection.nu b/tmt/tests/booted/readonly/052-test-bli-detection.nu index 474456670..12d4878db 100644 --- a/tmt/tests/booted/readonly/052-test-bli-detection.nu +++ b/tmt/tests/booted/readonly/052-test-bli-detection.nu @@ -29,6 +29,16 @@ if not ($os_id == "fedora" and $version_id >= 43) { exit 0 } +# DPS root discovery only works when bootc install to-disk created the +# partitions with DPS type GUIDs. In Packit/gating CI the system was +# installed via to-existing-root on pre-existing partitions, so skip. +# BCVK_EXPORT=1 is set by xtask when running via bcvk (image-mode). +if ($env.BCVK_EXPORT? | default "" | is-empty) { + print "# skip: not running in image-mode (BCVK_EXPORT not set)" + tap ok + exit 0 +} + print $"Running on ($os_id) ($version_id), checking DPS root discovery" let cmdline = (open /proc/cmdline)