------- Comment From <email address hidden> 2015-10-02 19:57 EDT-------
There's a different function path that's relevant here.
It seems the previous one only effects a config or something.
(I couldn't verify at install time w/ gdb yet, but per the call to 'nvram', it's likely to be correct now.)
The analysis points to ofpathname called w/ a /dev/mapper/mpathX path, which it can't work with.
So, the options are still handling this in either grub-installer or grub2.
It should be simpler to handle errors in grub-installer rather than grub2
(even accounting for checks of working/online paths, retries in case of errors, etc).
Function path and comments:
---------------------------------------
------- Comment From <email address hidden> 2015-10-02 19:57 EDT-------
There's a different function path that's relevant here.
It seems the previous one only effects a config or something.
(I couldn't verify at install time w/ gdb yet, but per the call to 'nvram', it's likely to be correct now.)
The analysis points to ofpathname called w/ a /dev/mapper/mpathX path, which it can't work with.
So, the options are still handling this in either grub-installer or grub2.
It should be simpler to handle errors in grub-installer rather than grub2
(even accounting for checks of working/online paths, retries in case of errors, etc).
Function path and comments: ------- ------- ------- ------- ----
-------
The boot device settings are modified here:
main() get_os_ disk (install_device); register_ ieee1275 (0, dev, partno, register_ ieee1275 (1, grub_util_ get_os_ disk (install_device),
@ grub-install.c
...
dev = grub_util_
grub_install_
"\\\\BootX");
...
grub_install_
0, NULL);
...
There are 2 relevant functions: register_ ieee1275( ) get_os_ disk()
- grub_install_
- grub_util_
First,
grub_install_ register_ ieee1275( ) osdep/unix/ platform. c
@ grub-core/
char *boot_device; get_default_ powerpc_ machtype (), "chrp_ibm") == 0)
...
ofpath = get_ofpathname (install_device);
...
ptr = grub_stpcpy (boot_device, ofpath);
...
boot_device = get_ofpathname (install_device);
...
if (strcmp (grub_install_
{
char *arg = xasprintf ("boot-device=%s", boot_device);
if (grub_util_exec ((const char * []){ "nvram",
"--update-config", arg, NULL }))
...
which runs 'nvram --update-config boot-device=' with the value printed by 'ofpathname' for that device.
get_ofpathname() osdep/unix/ platform. c
@ grub-core/
...
pid = grub_util_exec_pipe ((const char * []){ "ofpathname", dev, NULL }, &fd);
...
Second, 'that device' is obtained by:
grub_util_ get_os_ disk system_ partition_ to_system_ disk (os_dev, &is_part);
@ util/getroot.c
...
return convert_
...
convert_ system_ partition_ to_system_ disk() device_ is_mapped_ stat (&st)) devmapper_ part_to_ disk (&st, is_part, os_dev);
@ util/getroot.c
...
if (grub_util_
return grub_util_
...
grub_util_ devmapper_ part_to_ disk() osdep/devmapper /getroot. c get_dm_ node_linear_ info (st->st_rdev,
@ grub-core/
...
if (grub_util_
&major, &minor, 0))
{
*is_part = 1;
return grub_find_device ("/dev",
(major << 8) | minor);
}
*is_part = 0;
return xstrdup (path);
But grub_util_ get_dm_ node_linear_ info() doesn't understand mpath/LVM devmapper targets, only linear.
If it's linear, then it sets major and minor.
grub_util_ get_dm_ node_linear_ info() osdep/devmapper /hostdisk. c
@ grub-core/
...
if (node_uuid && (strncmp (node_uuid, "LVM-", 4) == 0
|| strncmp (node_uuid, "mpath-", 6) == 0))
{
dm_task_destroy (dmt);
break;
}
...
if (grub_strcmp (target, "linear") != 0)
{
dm_task_destroy (dmt);
break;
}
...
major = grub_strtoul (params, &ptr, 10);
...
minor = grub_strtoul (ptr, &ptr, 10);
Otherwise, later on:
return 1;
Which makes grub_util_ devmapper_ part_to_ disk() not to call grub_find_device(),
returning the same path it received.
This path is not understandable by ofpathname, so nvram probably ends up updating something incorrectly.