Tags: patch, upstream

this should be fixed with the attached patch included in Ubuntu
yakkety's grub2 package.

it uses the environment variable ZPOOL_VDEV_NAME_PATH to cause "zpool
status" to generate output like "zpool status -P" would (since the
latter is not available for all ZFS implementations, the environment
variable is the safe way to go).

since the output now contains device paths starting with '/', grub-probe
will not prepend them with '/dev/', but use them directly. this should
fix all of the possible device paths, not just '/dev/disk/by-*' like
previous patches attempting to fix this did.

note that this is filed upstream as http://savannah.gnu.org/bugs/?43653
but not yet fixed.

example output:

# zpool status
  pool: rpool
 state: ONLINE
  scan: none requested
config:

  NAME                               STATE     READ WRITE CKSUM
  rpool                              ONLINE       0     0     0
    ata-QEMU_HARDDISK_QM00001-part2  ONLINE       0     0     0
    ata-QEMU_HARDDISK_QM00002        ONLINE       0     0     0
  logs
    ata-QEMU_HARDDISK_QM00007        ONLINE       0     0     0

errors: No known data errors

# zpool status -P
  pool: rpool
 state: ONLINE
config:

  NAME                                               STATE     READ WRITE CKSUM
  rpool                                              ONLINE       0     0     0
    /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part2  ONLINE       0     0     0
    /dev/disk/by-id/ata-QEMU_HARDDISK_QM00002-part1  ONLINE       0     0     0
  logs
    /dev/disk/by-id/ata-QEMU_HARDDISK_QM00007-part1  ONLINE       0     0     0

errors: No known data errors

# ZPOOL_VDEV_NAME_PATH=YES zpool status
  pool: rpool
 state: ONLINE
  scan: none requested
config:

  NAME                                               STATE     READ WRITE CKSUM
  rpool                                              ONLINE       0     0     0
    /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part2  ONLINE       0     0     0
    /dev/disk/by-id/ata-QEMU_HARDDISK_QM00002-part1  ONLINE       0     0     0
  logs
    /dev/disk/by-id/ata-QEMU_HARDDISK_QM00007-part1  ONLINE       0     0     0

errors: No known data errors

Description: zfs-initramfs currently provides extraneous, undesired symlinks to
  devices directly underneath /dev/ to satisfy zpool's historical output of
  unqualified device names. By including this environment variable to signal
  our intent to zpool, zfs-linux packages can drop the symlink behavior when
  updating to its upstream or backported output behavior.
Author: Chad MILLER <chad.mil...@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1527727
Bug: https://savannah.gnu.org/bugs/?43653

--- a/grub-core/osdep/unix/getroot.c
+++ b/grub-core/osdep/unix/getroot.c
@@ -243,6 +243,7 @@ grub_util_find_root_devices_from_poolnam
   argv[2] = poolname;
   argv[3] = NULL;
 
+  setenv("ZPOOL_VDEV_NAME_PATH", "YES", 1);
   pid = grub_util_exec_pipe (argv, &fd);
   if (!pid)
     return NULL;

Reply via email to