From e720eef6a69bc4acc767d9a4cf8bc939b8b98e11 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 29 Oct 2018 12:33:37 +0000 Subject: [PATCH] Cope with / being on a ZFS root dataset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Colin Watson Tested-by: Fejes József Reviewed-by: Daniel Kiper --- 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