Skip to content

Commit fa10931

Browse files
committed
grubconfig: should use /sysroot for the physical root
Get hints from bootc code https://github.com/bootc-dev/bootc/blob/main/crates/lib/src/install.rs#L2017
1 parent 1768f31 commit fa10931

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/grubconfigs.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ pub(crate) fn install(
3030
installed_efi_vendor: Option<&str>,
3131
write_uuid: bool,
3232
) -> Result<()> {
33-
let bootdir = &target_root.sub_dir("boot").context("Opening /boot")?;
33+
let bootdir = target_root.sub_dir("boot").context("Opening /boot")?;
34+
// Should use /sysroot for the physical root
35+
let rootdir = target_root.sub_dir("sysroot").context("Opening /sysroot")?;
3436
let boot_is_mount = {
35-
let root_dev = target_root.self_metadata()?.stat().st_dev;
37+
let root_dev = rootdir.self_metadata()?.stat().st_dev;
3638
let boot_dev = bootdir.self_metadata()?.stat().st_dev;
3739
log::debug!("root_dev={root_dev} boot_dev={boot_dev}");
3840
root_dev != boot_dev
@@ -92,8 +94,8 @@ pub(crate) fn install(
9294
write_grubenv(&bootdir).context("Create grubenv")?;
9395

9496
let uuid_path = if write_uuid {
95-
let target_fs = if boot_is_mount { bootdir } else { target_root };
96-
let bootfs_meta = crate::filesystem::inspect_filesystem(target_fs, ".")?;
97+
let target_fs = if boot_is_mount { bootdir } else { rootdir };
98+
let bootfs_meta = crate::filesystem::inspect_filesystem(&target_fs, ".")?;
9799
let bootfs_uuid = bootfs_meta
98100
.uuid
99101
.ok_or_else(|| anyhow::anyhow!("Failed to find UUID for boot"))?;

0 commit comments

Comments
 (0)