[Bug 1048763] Re: grub-mkconfig/probe gives incorrect device name on PowerPC

ojordan 1048763 at bugs.launchpad.net
Mon Sep 10 18:47:10 UTC 2012


For the benefit of anybody else on PowerPC, this is what I did to
correct the 'hd0':

First generate a device.map

sudo grub-mkdevicemap

Then edit it

sudo nano /boot/grub/device.map

Change (hd0) to (hd).  Save.

Grub-probe/mkconfig then works correctly.


** Description changed:

  Hi, in my grub.cfg created with grub-mkconfig I have repeated lines like
  this:
  
- 	set root='(hd0,apple4)'
- 	search --no-floppy --fs-uuid --set=root big-long-number-1000
+  set root='(hd0,apple4)'
+  search --no-floppy --fs-uuid --set=root big-long-number-1000
  
  I'm on PowerPC and the 'hd0' I think should be just 'hd' (the
  openfirmware devalias).
  
  Tracing this back through the code I find it comes from
  prepare_grub_to_access_device (in grub-mkconfig_lib.in) which calls
  grub-probe (and this is where the hd0 comes from).  I haven't delved any
  further than this yet (I'm very rusty at reading code).  Obviously it
  would be great to fix grub-probe for PowerPC, but there is an obvious
- and easy solution in prepare_grub_to_access.  Currently the code is:
+ and easy solution in prepare_grub_to_access_device.  Currently the code
+ is:
  
-   # If there's a filesystem UUID that GRUB is capable of identifying, use it;
-   # otherwise set root as per value in device.map.
-   echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
-   if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then
-     echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
-   fi
+   # If there's a filesystem UUID that GRUB is capable of identifying, use it;
+   # otherwise set root as per value in device.map.
+   echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
+   if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then
+     echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+   fi
  
  I think there should be an elseif in there.  Currently is sets root
  using the device map and then immediatly overrides it with the UUID.  I
  can't see why it should be done twice.  It should be one or the other:
  use the device map OR the UUID.  This would also make grub.cfg files
  shorter and easier to read.
  
  If you need anymore info let me know!  Thanks
  
  lsb_release -rd
  Description: Ubuntu 12.04.1 LTS
  Release: 12.04
  
  dpkg -l | grep grub
  ii grub-common 1.99-21ubuntu3.1 GRand Unified Bootloader (common files)
  ii grub-ieee1275 1.99-21ubuntu3.1 GRand Unified Bootloader, version 2 (Open Firmware version)
  ii grub-ieee1275-bin 1.99-21ubuntu3.1 GRand Unified Bootloader, version 2 (Open Firmware binaries)
  ii grub2-common 1.99-21ubuntu3.1 GRand Unified Bootloader (common files for version 2)

-- 
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/1048763

Title:
  grub-mkconfig/probe gives incorrect device name on PowerPC

Status in “grub2” package in Ubuntu:
  New

Bug description:
  Hi, in my grub.cfg created with grub-mkconfig I have repeated lines
  like this:

   set root='(hd0,apple4)'
   search --no-floppy --fs-uuid --set=root big-long-number-1000

  I'm on PowerPC and the 'hd0' I think should be just 'hd' (the
  openfirmware devalias).

  Tracing this back through the code I find it comes from
  prepare_grub_to_access_device (in grub-mkconfig_lib.in) which calls
  grub-probe (and this is where the hd0 comes from).  I haven't delved
  any further than this yet (I'm very rusty at reading code).  Obviously
  it would be great to fix grub-probe for PowerPC, but there is an
  obvious and easy solution in prepare_grub_to_access_device.  Currently
  the code is:

    # If there's a filesystem UUID that GRUB is capable of identifying, use it;
    # otherwise set root as per value in device.map.
    echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
    if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then
      echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
    fi

  I think there should be an elseif in there.  Currently is sets root
  using the device map and then immediatly overrides it with the UUID.
  I can't see why it should be done twice.  It should be one or the
  other: use the device map OR the UUID.  This would also make grub.cfg
  files shorter and easier to read.

  If you need anymore info let me know!  Thanks

  lsb_release -rd
  Description: Ubuntu 12.04.1 LTS
  Release: 12.04

  dpkg -l | grep grub
  ii grub-common 1.99-21ubuntu3.1 GRand Unified Bootloader (common files)
  ii grub-ieee1275 1.99-21ubuntu3.1 GRand Unified Bootloader, version 2 (Open Firmware version)
  ii grub-ieee1275-bin 1.99-21ubuntu3.1 GRand Unified Bootloader, version 2 (Open Firmware binaries)
  ii grub2-common 1.99-21ubuntu3.1 GRand Unified Bootloader (common files for version 2)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1048763/+subscriptions




More information about the foundations-bugs mailing list