Bug#886178: An extra trailing slash is added to ZFS root pool and it's not bootable

Colin Watson cjwatson at debian.org
Mon Oct 29 00:21:21 GMT 2018


On Tue, Jan 02, 2018 at 10:15:09PM +0100, Fejes József wrote:
> I have my root filesystem on ZFS. I'm using a ZFS pool's root dataset
> (rpool) as opposed to a sub-dataset (eg. rpool/foo or rpool/foo/bar).
> 
> update-grub calls calls /etc/grub.d/10_linux which sets the root=ZFS=
> parameter for grub/initrd. In this case, it sets it as
> root=ZFS=rpool/. Note the trailing slash. This is invalid and makes
> the system unbootable.
> 
> I already filed this bug at https://savannah.gnu.org/bugs/?52746 . But
> that bugtracker looks completely abandoned for months. I'm pretty sure
> it only needs a small fix to remove extra trailing slashes.

I think this patch would be sufficient (since in non-root-dataset cases
$bootfs has no trailing slash).  Could you test this?

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
 

Thanks,

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Pkg-grub-devel mailing list