All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails
@ 2020-12-18  2:27 Doug Goldstein
  2020-12-18 13:38 ` Daniel Kiper
  2020-12-23 23:29 ` Daniel Kiper
  0 siblings, 2 replies; 4+ messages in thread
From: Doug Goldstein @ 2020-12-18  2:27 UTC (permalink / raw)
  To: grub-devel
  Cc: Richard Laager, Vladimir Serbinenko, Colin Watson, Doug Goldstein

When grub-probe fails, the current code is to just stuff an empty result
in which causes the user to not knowingly have a system that no longer
boots. grub-probe can fail because the ZFS pool that contains the root
filesystem might have features that grub does not yet support which is a
common configuration for people with a rpool and a bpool. This behavior
uses the zdb utility to dump the same value as the filesystem label
would print.

Signed-off-by: Doug Goldstein <cardoe@cardoe.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 e8b01c0d0..33a25ba8f 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -71,7 +71,7 @@ case x"$GRUB_FS" in
 	    GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
 	fi;;
     xzfs)
-	rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
+	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%/}"
 	;;
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 3b1f47049..96210c24d 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -79,7 +79,7 @@ case x"$GRUB_FS" in
 	    GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
 	fi;;
     xzfs)
-	rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
+	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%/}"
 	;;
-- 
2.24.3 (Apple Git-128)



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails
  2020-12-18  2:27 [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails Doug Goldstein
@ 2020-12-18 13:38 ` Daniel Kiper
  2020-12-23 23:29 ` Daniel Kiper
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2020-12-18 13:38 UTC (permalink / raw)
  To: Doug Goldstein
  Cc: grub-devel, Vladimir Serbinenko, Richard Laager, Colin Watson

On Thu, Dec 17, 2020 at 08:27:14PM -0600, Doug Goldstein wrote:
> When grub-probe fails, the current code is to just stuff an empty result
> in which causes the user to not knowingly have a system that no longer
> boots. grub-probe can fail because the ZFS pool that contains the root
> filesystem might have features that grub does not yet support which is a
> common configuration for people with a rpool and a bpool. This behavior
> uses the zdb utility to dump the same value as the filesystem label
> would print.
>
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails
  2020-12-18  2:27 [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails Doug Goldstein
  2020-12-18 13:38 ` Daniel Kiper
@ 2020-12-23 23:29 ` Daniel Kiper
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2020-12-23 23:29 UTC (permalink / raw)
  To: The development of GNU GRUB
  Cc: Vladimir Serbinenko, Richard Laager, Doug Goldstein, Colin Watson

On Thu, Dec 17, 2020 at 08:27:14PM -0600, Doug Goldstein wrote:
> When grub-probe fails, the current code is to just stuff an empty result
> in which causes the user to not knowingly have a system that no longer
> boots. grub-probe can fail because the ZFS pool that contains the root
> filesystem might have features that grub does not yet support which is a
> common configuration for people with a rpool and a bpool. This behavior
> uses the zdb utility to dump the same value as the filesystem label
> would print.
>
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

For an unknown reason xgettext hangs during build after this patch.
Could you check what is going on?

Daniel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails
       [not found] <665CCEA0-1C5D-4A26-976D-1A7F539AB7E2@pm.me>
@ 2022-02-06 10:05 ` Tom Matthews
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Matthews @ 2022-02-06 10:05 UTC (permalink / raw)
  To: grub-devel; +Cc: cardoe


> On Thu, Dec 17, 2020 at 08:27:14PM -0600, Doug Goldstein wrote:
>> When grub-probe fails, the current code is to just stuff an empty result
>> in which causes the user to not knowingly have a system that no longer
>> boots. grub-probe can fail because the ZFS pool that contains the root
>> filesystem might have features that grub does not yet support which is a
>> common configuration for people with a rpool and a bpool. This behavior
>> uses the zdb utility to dump the same value as the filesystem label
>> would print.
>>
>> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
>
> For an unknown reason xgettext hangs during build after this patch.
> Could you check what is going on?
>
> Daniel

I just applied Dougs patch to the latest git master branch code,
and found no issue through any of the bootstrap, configure, or make stages.

Daniel, would you be able to try your build again with the patch please?

Tom




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-06 10:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18  2:27 [PATCH] zfs: fix LINUX_ROOT_DEVICE when grub-probe fails Doug Goldstein
2020-12-18 13:38 ` Daniel Kiper
2020-12-23 23:29 ` Daniel Kiper
     [not found] <665CCEA0-1C5D-4A26-976D-1A7F539AB7E2@pm.me>
2022-02-06 10:05 ` Tom Matthews

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.