If / is on the root dataset in a ZFS pool, then ${bootfs} will be set to
"/" (whereas if it is on a non-root dataset, there will be no trailing
slash).  Passing "root=ZFS=${rpool}/" will fail to boot, but
"root=ZFS=${rpool}" works fine, so strip the trailing slash.

Fixes: https://savannah.gnu.org/bugs/?52746
Tested-by: Fejes József <jozsef.fe...@gmail.com>
Signed-off-by: Colin Watson <cjwat...@ubuntu.com>
---
 util/grub.d/10_linux.in     | 2 +-
 util/grub.d/20_linux_xen.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 61ebd7dc7..4532266be 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -73,7 +73,7 @@ case x"$GRUB_FS" in
     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}"
+       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
        ;;
 esac
 
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index e8143b079..d22626e30 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -81,7 +81,7 @@ case x"$GRUB_FS" in
     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}"
+       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
        ;;
 esac
 
-- 
2.19.1

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to