diff -Nru grub2-2.02~beta2/debian/changelog grub2-2.02~beta2/debian/changelog --- grub2-2.02~beta2/debian/changelog 2016-01-28 08:30:23.000000000 -0500 +++ grub2-2.02~beta2/debian/changelog 2016-02-02 15:54:38.000000000 -0500 @@ -1,3 +1,12 @@ +grub2 (2.02~beta2-35ubuntu2) xenial; urgency=medium + + * debian/patches/grubprobe-zfspool-device-name-prepend: Qualifing zfs-pool + device names using "/dev/", which we get from "zpool status", is ususally + wrong. Given an unqualified name, search also /dev/disk/ paths and verify + a name actually exists before using it. (LP: #1527727) + + -- Chad MILLER Tue, 02 Feb 2016 15:51:16 -0500 + grub2 (2.02~beta2-35ubuntu1) xenial; urgency=medium * debian/postinst.in, debian/kernel/zz-update-grub: Call systemd-detect-virt diff -Nru grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend --- grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend 1969-12-31 19:00:00.000000000 -0500 +++ grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend 2016-02-02 15:50:04.000000000 -0500 @@ -0,0 +1,38 @@ +Description: Test several locations for the name returned in polling zpool + devices. +Author: Chad Miller +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1527727 + +--- a/grub-core/osdep/unix/getroot.c ++++ b/grub-core/osdep/unix/getroot.c +@@ -303,11 +303,24 @@ grub_util_find_root_devices_from_poolnam + devices = xrealloc (devices, sizeof (devices[0]) + * devices_allocated); + } +- if (name[0] == '/') +- devices[ndevices++] = xstrdup (name); +- else +- devices[ndevices++] = xasprintf ("/dev/%s", name); +- } ++ if (name[0] == '/') { ++ devices[ndevices++] = xstrdup (name); ++ } else { ++ const char *middles[] = { "disk/by-id/", "disk/by-uuid/", "disk/by-partuuid/", "disk/by-label/", "disk/by-partlabel/", "disk/by-path/", "/", NULL }; ++ ++ for (const char **cursor = middles; *cursor != NULL; cursor++) { ++ char *proposed = xasprintf ("/dev/%s/%s", *cursor, name); ++ struct stat stt; ++ /* Peek at what exists to know what to say the device is. */ ++ if (lstat (proposed, &stt) == 0) { ++ devices[ndevices++] = proposed; ++ break; ++ } else { ++ free(proposed); ++ } ++ } ++ } ++ } + break; + } + + diff -Nru grub2-2.02~beta2/debian/patches/series grub2-2.02~beta2/debian/patches/series --- grub2-2.02~beta2/debian/patches/series 2016-01-22 06:00:23.000000000 -0500 +++ grub2-2.02~beta2/debian/patches/series 2016-02-02 15:49:18.000000000 -0500 @@ -97,3 +97,4 @@ zfs-zap-lookup-truncation.patch zfs-extensible-dataset-large-blocks.patch 0099-Work-around-unsupported-relocations-on-arm64.patch +grubprobe-zfspool-device-name-prepend