* [PATCH] zfs: fix root dataset detection on encrypted pools
@ 2026-02-09 18:56 Christian Schoenebeck via Grub-devel
2026-02-18 10:28 ` Christian Schoenebeck via Grub-devel
0 siblings, 1 reply; 3+ messages in thread
From: Christian Schoenebeck via Grub-devel @ 2026-02-09 18:56 UTC (permalink / raw)
To: grub-devel; +Cc: Christian Schoenebeck
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 <linux_oss@crudebyte.com>
---
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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] zfs: fix root dataset detection on encrypted pools
2026-02-09 18:56 [PATCH] zfs: fix root dataset detection on encrypted pools Christian Schoenebeck via Grub-devel
@ 2026-02-18 10:28 ` Christian Schoenebeck via Grub-devel
2026-02-26 9:52 ` Christian Schoenebeck via Grub-devel
0 siblings, 1 reply; 3+ messages in thread
From: Christian Schoenebeck via Grub-devel @ 2026-02-18 10:28 UTC (permalink / raw)
To: grub-devel; +Cc: Christian Schoenebeck
On Monday, 9 February 2026 19:56:00 CET Christian Schoenebeck wrote:
> 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 <linux_oss@crudebyte.com>
> ---
> util/grub.d/10_linux.in | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Ping, anyone?
/Christian
> 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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] zfs: fix root dataset detection on encrypted pools
2026-02-18 10:28 ` Christian Schoenebeck via Grub-devel
@ 2026-02-26 9:52 ` Christian Schoenebeck via Grub-devel
0 siblings, 0 replies; 3+ messages in thread
From: Christian Schoenebeck via Grub-devel @ 2026-02-26 9:52 UTC (permalink / raw)
To: grub-devel
Cc: Christian Schoenebeck, Daniel Kiper, Alex Burmashev,
Vladimir 'phcoder' Serbinenko
On Wednesday, 18 February 2026 11:28:18 CET Christian Schoenebeck wrote:
> On Monday, 9 February 2026 19:56:00 CET Christian Schoenebeck wrote:
> > 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 <linux_oss@crudebyte.com>
> > ---
> >
> > util/grub.d/10_linux.in | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
Ping
> Ping, anyone?
>
> /Christian
>
> > 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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-26 9:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 18:56 [PATCH] zfs: fix root dataset detection on encrypted pools Christian Schoenebeck via Grub-devel
2026-02-18 10:28 ` Christian Schoenebeck via Grub-devel
2026-02-26 9:52 ` Christian Schoenebeck via Grub-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox