[Bug 1097570] Re: grub2-signed can not find the right device when there are two filesystems containing the file '.disk/info'.
Colin Watson
cjwatson at canonical.com
Thu Dec 12 12:10:01 UTC 2013
On Thu, Dec 12, 2013 at 11:24:31AM -0000, Bin Li wrote:
> @Collin,
My given name only has one "l", FYI.
> And a question, is there a way to check the $prefix's value before
> search?
I'm afraid the signed image business makes this very tedious. The
simplest method would probably be to take debian/build-efi-images from
the grub2 source package, extend its skeleton grub.cfg to print the
prefix and sleep for a while as the first thing it does, put the
resulting gcdx64.efi on a modified CD image, make sure you're in setup
mode if you're on a system with UEFI Secure Boot so that you don't have
to sign the image, and try booting it.
> And the $prefix was set by grub-mkimage with '-p' parameter?
Sort of. We pass a partial prefix using "-p /boot/grub". The effect of
this is to instruct the GRUB kernel to look for the device from which it
was loaded (on EFI, this uses the Loaded Image Protocol); if it finds
that device, it will set the prefix to (that-device)/boot/grub,
otherwise it will leave it unset.
An unset prefix at the stage you describe in comment #21 would imply
that GRUB entirely failed to get the loaded image location, or possibly
that it failed to determine a GRUB drive name from it. A nonexistent
prefix would perhaps imply that it picked the wrong GRUB drive.
If you're going to be building custom images anyway to diagnose this,
then it might be worth simply modifying GRUB to insert some grub_printf
and grub_millisleep calls so that we can see what it's doing when trying
to discover the loaded image location. Something like this:
=== modified file 'grub-core/kern/efi/init.c'
--- grub-core/kern/efi/init.c 2010-09-08 12:53:47 +0000
+++ grub-core/kern/efi/init.c 2013-12-12 12:06:24 +0000
@@ -68,10 +68,16 @@ grub_efi_set_prefix (void)
if ((!device || device[0] == ',' || !device[0]) || !path)
image = grub_efi_get_loaded_image (grub_efi_image_handle);
+ grub_printf ("image: %p\n", image);
+ grub_millisleep (1000);
if (image)
{
if (!device)
- device = grub_efidisk_get_device_name (image->device_handle);
+ {
+ device = grub_efidisk_get_device_name (image->device_handle);
+ grub_printf ("device: %s\n", device);
+ grub_millisleep (1000);
+ }
else if (device[0] == ',' || !device[0])
{
/* We have a partition, but still need to fill in the drive. */
@@ -113,6 +119,8 @@ grub_efi_set_prefix (void)
prefix = grub_xasprintf ("(%s)%s", device, path);
if (prefix)
{
+ grub_printf ("setting prefix: %s\n", prefix);
+ grub_millisleep (1000);
grub_env_set ("prefix", prefix);
grub_free (prefix);
}
I do think we should investigate this in a separate bug report, though;
and I'd like to know whether the fix currently in precise-proposed at
least improves things for Shih-Yuan Lee in the same way that the fix in
saucy did (comment #13).
--
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/1097570
Title:
grub2-signed can not find the right device when there are two
filesystems containing the file '.disk/info'.
Status in OEM Priority Project:
Triaged
Status in OEM Priority Project precise series:
Triaged
Status in “grub2” package in Ubuntu:
Fix Released
Status in “grub2” source package in Precise:
Fix Committed
Status in “grub2” source package in Raring:
Invalid
Bug description:
SRU justification:
[Impact] When using UEFI, GRUB doesn't always determine the correct boot device to chain to if multiple Ubuntu bootable media are attached.
[Test Case] Described below.
[Regression Potential] When I fixed this in saucy, I made a mistake that broke UEFI Secure Boot (fixed in 2.00-18ubuntu4). I made sure to cherry-pick that fix as well here, but it's worth testing both paths.
Original report follows:
* Ubuntu 12.04.2 LTS "Precise Pangolin" - Release amd64 (20130108)
precise-desktop-amd64.iso from http://cdimage.ubuntu.com/precise/daily-live/current/ .
* Package Version
grub2-signed 1.9~ubuntu12.04.2+1.99-21ubuntu3.7
* Reproduce Steps
1. Use `usb-creator-gtk` to create a bootable USB drive by precise-desktop-amd64.iso
2. Use this USB drive to boot "Try Ubuntu without installing" on an UEFI secure boot enabled laptop.
3. Create only one 1GB primary fat32 partition on the disk of the laptop with GPT-based disk layout.
4. Mount fat32 partition on /mnt
$ sudo mount /dev/sda1 /mnt
5. Manually copy all contents from the USB stick into the fat32 partition.
$ sudo cp -av /cdrom/.disk /cdrom/* /mnt
6. Set up the EFI boot entry.
$ sudo apt-get install efibootmgr grub-efi-amd64-signed shim-signed
$ sudo grub-install --removable --uefi-secure-boot --root-directory /mnt /dev/sda1
$ sudo efibootmgr -c -d /dev/sda -p 1 -l "\\EFI\\BOOT\\BOOTx64.EFI" -L recovery
7. Append 'from recovery partition' to every menuentry title in /mnt/boot/grub/grub.cfg .
8. Reboot and select the boot entry 'recovery' from UEFI boot option menu.
* Expected Result
We can see every menu entry of grub with the suffix 'from recovery partition'.
* Actual Result
There is no suffix 'from recovery partition' on menu entries of grub.
P.S. The USB drive is still plunged in the laptop. After we unplug the
USB drive and select the boot entry 'recovery' from UEFI boot option
menu, we can see every menu entry of grub with the suffix 'from
recovery partition'.
To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/1097570/+subscriptions
More information about the foundations-bugs
mailing list