grub-probe fails on encrypted zfs pools, causing $rpool variable to be empty. Therefore check variables $rpool and $bootfs to be both non-empty strings before assembling LINUX_ROOT_DEVICE.
If one of the two variables is empty, use "zfs list" as fallback for detecting the zfs root dataset instead. Signed-off-by: Christian Schoenebeck <[email protected]> --- util/grub.d/10_linux.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 07649cd3b..acbd2ab64 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -75,7 +75,13 @@ case x"$GRUB_FS" in xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || zdb -l ${GRUB_DEVICE} | awk -F \' '/ name/ { print $2 }'` bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" - LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}" + # grub-probe fails on encrypted zfs pools, use zfs list as fallback + if [ -n "$rpool" ] && [ -n "$bootfs" ]; then + LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}" + else + root_dataset=`zfs list -Ho mountpoint,name | grep '^/[[:space:]]' | tail -n1 | cut -f 2 2>/dev/null || true` + LINUX_ROOT_DEVICE="ZFS=${root_dataset}" + fi ;; esac -- 2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
