[Bug 1527727] Re: grub-probe for zfs assumes all devices prefix with /dev, ignoring /dev/disk/...
Chad Miller
chad.miller at canonical.com
Fri Dec 18 22:11:19 UTC 2015
Attached is debdiff. Important change is in grub-
core/osdep/unix/getroot.c, function
grub_util_find_root_devices_from_poolname
+--- a/grub-core/osdep/unix/getroot.c
++++ b/grub-core/osdep/unix/getroot.c
+@@ -305,8 +305,18 @@ grub_util_find_root_devices_from_poolnam
+ }
+ if (name[0] == '/')
+ devices[ndevices++] = xstrdup (name);
+- else
+- devices[ndevices++] = xasprintf ("/dev/%s", 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;
++ if (lstat (proposed, &stt) == 0) {
++ devices[ndevices++] = proposed;
++ break;
++ }
++ }
++ }
+ }
+ break;
+ }
** Attachment added: "xenial debdiff"
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1527727/+attachment/4537081/+files/diff
** Changed in: grub2 (Ubuntu)
Status: New => Confirmed
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1527727
Title:
grub-probe for zfs assumes all devices prefix with /dev, ignoring
/dev/disk/...
Status in grub2 package in Ubuntu:
Confirmed
Bug description:
update-grub runs /usr/sbin/grub-probe
/usr/sbin/grub-probe runs ["zpool", "status", poolname]
zpool responds with device names as used at (I think!) pool creation
time. Often, this is /dev/disk/by-id/... names, without the path.
grub-probe then parses the output, and takes the names of devices, and
if they do not start with a "/", it prepends "/dev/".
It then tests the existence of the path name of the device. it fails.
grub-probe then returns something like
/usr/sbin/grub-probe: error: failed to get canonical path of `/dev
/ata-ST31000333AS_99999999-part1'.
The actual path is of course /dev/disk/by-
id/ST31000333AS_99999999-part1
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1527727/+subscriptions
More information about the foundations-bugs
mailing list