Bug#848945: Patch to fix empty pool name

Chris Dos chris at chrisdos.com
Thu Feb 2 23:22:37 UTC 2017


I had this same issue: https://github.com/zfsonlinux/pkg-zfs/issues/182

I wrote a patch the requires the setting of the "zpool bootfs" parameter which I think should be a requirement anyway.  The other solutions did not seem to work in every situation and I was still having issues with some systems.

That patch also checks against multiple "zpool bootfs" parameters or a missing entry all together.


Patch START:

*** /tmp/10_linux.orig    2017-02-02 08:02:36.926542777 -0700
--- /etc/grub.d/10_linux    2017-02-02 15:26:02.138285042 -0700
***************
*** 77,85 ****
          GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
      fi;;
      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}"
      ;;
  esac
 
--- 77,96 ----
          GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
      fi;;
      xzfs)
!     zfsbootfs=`zpool get bootfs | sed '2,100!d' |  grep -v "-" | awk {'print $3'} 2>/dev/null || true`
!     if [ "${zfsbootfs}" = "" ]
!     then
!         echo "zpool bootfs parameter not set.  System will fail to boot!" 1>&2
!     elif [ "$(echo ${zfsbootfs} | wc -w)" -gt "1" ]
!     then
!         echo "Multiple zpool bootfs parameters detected:" 1>&2
!         echo ${zfsbootfs} 1>&2
!                 echo 1>&2
!         zfsbootfs=`echo ${zfsbootfs} | awk {'print $1'}`
!         echo "Using the first bootfs listed: ${zfsbootfs}" 1>&2
!         echo "Final LINUX_ROOT_DEVICE=ZFS=${zfsbootfs}" 1>&2
!     fi
!     LINUX_ROOT_DEVICE="ZFS=${zfsbootfs}"
      ;;
  esac

Patch END

Save the patch as /tmp/grub_10_linux.patch and apply it to the /etc/grub.d/10_linux file:
patch -p1 /etc/grub.d/10_linux /tmp/grub_10_linux.patch


-------------- next part --------------
A non-text attachment was scrubbed...
Name: grub_10_linux.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20170202/c276d34b/attachment.bin>


More information about the Pkg-grub-devel mailing list