[Bug 1501015] Comment bridged from LTC Bugzilla

bugproxy bugproxy at us.ibm.com
Fri Oct 2 20:01:36 UTC 2015


------- Comment From mauricfo at br.ibm.com 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()
@ grub-install.c
...
dev = grub_util_get_os_disk (install_device);
grub_install_register_ieee1275 (0, dev, partno,
"\\\\BootX");
...
grub_install_register_ieee1275 (1, grub_util_get_os_disk (install_device),
0, NULL);
...

There are 2 relevant functions:
- grub_install_register_ieee1275()
- grub_util_get_os_disk()

First,

grub_install_register_ieee1275()
@ grub-core/osdep/unix/platform.c

char *boot_device;
...
ofpath = get_ofpathname (install_device);
...
ptr = grub_stpcpy (boot_device, ofpath);
...
boot_device = get_ofpathname (install_device);
...
if (strcmp (grub_install_get_default_powerpc_machtype (), "chrp_ibm") == 0)
{
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()
@ grub-core/osdep/unix/platform.c
...
pid = grub_util_exec_pipe ((const char * []){ "ofpathname", dev, NULL }, &fd);
...

Second, 'that device' is obtained by:

grub_util_get_os_disk
@ util/getroot.c
...
return convert_system_partition_to_system_disk (os_dev, &is_part);
...

convert_system_partition_to_system_disk()
@ util/getroot.c
...
if (grub_util_device_is_mapped_stat (&st))
return grub_util_devmapper_part_to_disk (&st, is_part, os_dev);
...

grub_util_devmapper_part_to_disk()
@ grub-core/osdep/devmapper/getroot.c
...
if (grub_util_get_dm_node_linear_info (st->st_rdev,
&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()
@ grub-core/osdep/devmapper/hostdisk.c
...
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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub-installer in Ubuntu.
https://bugs.launchpad.net/bugs/1501015

Title:
  ISST-LTE: Multipath disk is not automatically set as 1st boot device
  after installation

Status in grub-installer package in Ubuntu:
  New

Bug description:
  == Comment: #11 - Gary M. Gaydos <gmgaydos at us.ibm.com> - 2015-09-29 14:37:05 ==
  Steps to reproduce:

  Install 15.10 beta 1 ppc little endian using multipath disks (in this case mpatha)
  After the installation is finished no device is set as the first boot device.

  The symptom is the same as launchpad bug 1486022 against 14.04.3.
  Syslog from 1486022 and this bug are different however.  In 1486022 no
  mpath devices are found.  In this bug mpath2a (the installation
  target) has an unknown device type, and the volume group is not found.

  Here's a snippet from the syslog

  cat syslog |grep -a2 -b2 mpatha2
   
  423185-Sep 28 07:42:34 in-target: grub-common is already the newest version.
  423255-Sep 28 07:42:34 in-target: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  423345:Sep 28 07:42:41 grub-installer: info: Identified partition label for /dev/mapper/mpatha2: loop
  423440-Sep 28 07:42:44 grub-installer: info: Wiping PReP partition /dev/mapper/mpatha1
  423520-Sep 28 07:42:45 in-target: Reading package lists...
  --
  426988-Sep 28 07:42:51 in-target: Creating config file /etc/default/grub with new version^M
  427073-Sep 28 07:42:51 in-target: Installing for powerpc-ieee1275 platform.^M
  427144:Sep 28 07:42:55 in-target: grub-install: warning: unknown device type mpatha2^M
  427224-Sep 28 07:42:55 in-target: .^M
  427255-Sep 28 07:42:56 in-target: Installation finished. No error reported.^M
  --
  459265-Sep 28 07:45:40 main-menu[843]: (process:73364): File descriptor 5 (/dev/hvc0) leaked on lvdisplay invocation. Parent PID 74098: /bin/sh
  459402-Sep 28 07:45:40 main-menu[843]: (process:73364): File descriptor 6 (/dev/hvc0) leaked on lvdisplay invocation. Parent PID 74098: /bin/sh
  459539:Sep 28 07:45:40 main-menu[843]: (process:73364):   Volume group "mpatha2" not found
  459623:Sep 28 07:45:40 main-menu[843]: (process:73364):   Cannot process volume group mpatha2
  459710-Sep 28 07:45:40 main-menu[843]: (process:73364): umount: can't umount /target/proc /sys: No such file or directory
  459825-Sep 28 07:45:40 main-menu[843]: INFO: Menu item 'finish-install' selected

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/1501015/+subscriptions



More information about the foundations-bugs mailing list