After applying the previous patch, apply this patch to show recovery
instructions when root pool detection fails. Also the description has
been improved.

This could be very useful guiding people to fix failed root pool detection.

---
 util/grub-mkconfig.in | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 04f8a11e6..2c3958ae1 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -291,8 +291,21 @@ if test "x${grub_cfg}" != "x" ; then
   if test "x${GRUB_FS}" = "xzfs" ; then
     if grep -q "grub_root_pool_detection_failed" ${grub_cfg}.new ; then
        gettext_printf "Root pool detection failed!
-You must specify correct pool name with GRUB_ZFS_ALT_RPOOL
-and run the command again. Otherwise system will not boot." >&2
+You must specify pool name detection command with GRUB_ZFS_ALT_RPOOL
+and run the command again. Otherwise system will not boot.
+
+Possible detection commands:
+
+with zdb
+    if
+        zdb -l %s | grep -E '[[:blank:]]name' | cut -d\\\' -f 2
+    returns root pool name, then try set
+        export GRUB_ZFS_ALT_RPOOL=\"zdb -l \\\${GRUB_DEVICE} | grep -E 
'[[:blank:]]name' | cut -d\\\' -f 2\"
+with blkid
+    if
+        blkid -s LABEL -o value %s
+    returns root pool name, then try set
+        export export GRUB_ZFS_ALT_RPOOL='blkid -s LABEL -o value 
\${GRUB_DEVICE}'" "${GRUB_DEVICE}" "${GRUB_DEVICE}" >&2
        echo >&2
        exit 1
     fi
--
2.30.0

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to