public inbox for grub-devel@gnu.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck via Grub-devel <grub-devel@gnu.org>
To: grub-devel@gnu.org
Cc: Christian Schoenebeck <linux_oss@crudebyte.com>
Subject: Re: [PATCH] zfs: fix root dataset detection on encrypted pools
Date: Wed, 18 Feb 2026 11:28:18 +0100	[thread overview]
Message-ID: <5049910.GXAFRqVoOG@weasel> (raw)
In-Reply-To: <E1vpWhC-001CMr-4m@kylie.crudebyte.com>

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

  reply	other threads:[~2026-02-18 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-02-26  9:52   ` Christian Schoenebeck via Grub-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5049910.GXAFRqVoOG@weasel \
    --to=grub-devel@gnu.org \
    --cc=linux_oss@crudebyte.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox