[Bug 711732] Re: grub2 grub-install not working for secondary devices (USB Disk)

Marcus Tomlinson marcus.tomlinson at canonical.com
Thu Mar 5 12:49:00 UTC 2020


This release of Ubuntu is no longer receiving maintenance updates. If
this is still an issue on a maintained version of Ubuntu please let us
know.

** Changed in: grub2 (Ubuntu)
       Status: New => Incomplete

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

Title:
  grub2 grub-install not working for secondary devices (USB Disk)

Status in grub2 package in Ubuntu:
  Incomplete

Bug description:
  Binary package hint: grub2

  I'm trying to install grub2 on a secondary device (a USB disk which a complete linux installed). The device was automatically mounted at /media/<devicename>. 
  I call "sudo grub-install --root-directory=/media/<devicename> /dev/sdc" (device name is correct). The installation succeeds. When trying to start the device (either by using QEMU or by plugging it into another PC without any local disc), I get the error "error: no such device <UUID>". The UUID printed out is the one of my boot partition (dev/sda1) I called grub-install from.  The startup procedure stops. 

  I added some debug messages to grub.cfg on my device but it looks like
  it is not getting to that point at all.

  Trying to dig this down I found that in /usr/sbin/grub-install, grub-probe is called with the following parameters:
  "/usr/sbin/grub-probe --device-map=/media/<devicename>/boot/grub/device.map --target=device /media/<devicename>/boot/grub"
  This call returns /dev/sda1 - all follow up calls use this device and thereby retrieving information of the wrong device. Thereby the wrong UUID is gathered. I would expect grub-probe to return the device /media/<devicename> is located on (in my case /dev/sdc1)

  The content of /media/<devicename>/boot/grub/device.map:
  (fd0)	        /dev/fd0
  (hd0)	/dev/sda
  (hd1)	/dev/sdb
  (hd2)	/dev/sdc

  The next item I had to circumvent was the relative path returned by
  "make_system_path_relative_to_its_root". Although the right device was
  used throughout the whole grub-install script, this call still did not
  remove the leading "/media/<devicename>".

  I ended up hard-coding the following items in /usr/sbin/grub-install to get the installation working:
  - grub-probe call in line 303 -> grub-probe is returning wrong device
  - make_system_path_relative_to_its_root in line 332 -> function is not removing relative path

  By doing all this changes (hard-coding, not fixing them, sorry) I
  finally made grub-install work on USB devices.

  My Ubuntu release:
  Description:	Ubuntu 10.10
  Release:	10.10

  Package version of grub2: 
  grub2:
    Installed: 1.98+20100804-5ubuntu3.1
    Candidate: 1.98+20100804-5ubuntu3.1
    Version table:
   *** 1.98+20100804-5ubuntu3.1 0
          500 http://archive.ubuntu.com/ubuntu/ maverick-proposed/universe i386 Packages
          100 /var/lib/dpkg/status
       1.98+20100804-5ubuntu3 0
          500 http://archive.ubuntu.com/ubuntu/ maverick/universe i386 Packages

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



More information about the foundations-bugs mailing list