grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] grub-mkconfig/10_linux: fix zfs root pool-name identification


From: Felix Dörre
Subject: [PATCH] grub-mkconfig/10_linux: fix zfs root pool-name identification
Date: Fri, 27 Dec 2024 01:28:13 +0100
User-agent: Mozilla Thunderbird

When generating grub-config, we use our own tool "grub_probe" to
identify the name of the zpool where the filesystem root is stored.
However, this approach is flawed. ZFS continuously adds new features, and
usually the pool where the root filesystem is stored will use more features
than are currently implemented in grub. That's why most installation guides
suggest to have a pool that grub can read, and a different pool for root
where all features are enabled.

Having two pools still causes the detection logic to fail, as grub_probe will 
not be
able to understand the pool where "/" is on and determine its label.
Conceptually it does not make sense, that grub tries to parse this pool with
its own tool, as grub will never open or read this pool, it just needs to pass
its label as root device to initramfs and never open or find it.

For this reason grub should not use its own tool to determine the pool name, 
but any
other zfs or general linux tool that can identify the currently mounted pool.

Bug: https://savannah.gnu.org/bugs/?59614
Bug: https://savannah.gnu.org/bugs/?58555
---
 util/grub.d/10_linux.in | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index cc393be7e..ab353c85f 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -73,9 +73,8 @@ case x"$GRUB_FS" in
            GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} 
${GRUB_CMDLINE_LINUX}"
        fi;;
     xzfs)
-       rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 
2>/dev/null || true`
-       bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
-       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
+       bootfs=`findmnt --direction backward --first-only --noheadings -o 
SOURCE /`
+       LINUX_ROOT_DEVICE="ZFS=${bootfs}"
        ;;
 esac
--
2.45.2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]