grub2-signed can not find the right device when there are two filesystems containing the file '.disk/info'.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OEM Priority Project |
Won't Fix
|
Medium
|
Unassigned | ||
grub2 (Ubuntu) |
In Progress
|
High
|
Mathieu Trudel-Lapierre | ||
Precise |
Won't Fix
|
High
|
Unassigned | ||
Raring |
Won't Fix
|
High
|
Unassigned | ||
Trusty |
Triaged
|
High
|
Mathieu Trudel-Lapierre |
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-
* Package Version
grub2-signed 1.9~ubuntu12.
* Reproduce Steps
1. Use `usb-creator-gtk` to create a bootable USB drive by precise-
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-
$ sudo grub-install --removable --uefi-secure-boot --root-directory /mnt /dev/sda1
$ sudo efibootmgr -c -d /dev/sda -p 1 -l "\\EFI\
7. Append 'from recovery partition' to every menuentry title in /mnt/boot/
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'.
description: | updated |
Changed in grub2 (Ubuntu): | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in grub2 (Ubuntu): | |
assignee: | nobody → Brian Murray (brian-murray) |
Changed in oem-priority: | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in oem-priority: | |
assignee: | nobody → James M. Leddy (jm-leddy) |
tags: | added: rls-r-incoming |
Changed in oem-priority: | |
status: | Triaged → Incomplete |
Changed in grub2 (Ubuntu Precise): | |
milestone: | none → ubuntu-12.04.3 |
status: | New → Triaged |
importance: | Undecided → High |
Changed in grub2 (Ubuntu Raring): | |
assignee: | Brian Murray (brian-murray) → Colin Watson (cjwatson) |
Changed in oem-priority: | |
status: | Incomplete → Triaged |
tags: |
added: precise raring removed: rls-r-incoming |
Changed in grub2 (Ubuntu Precise): | |
milestone: | ubuntu-12.04.3 → ubuntu-12.04.4 |
Changed in grub2 (Ubuntu Raring): | |
status: | Triaged → Incomplete |
Changed in grub2 (Ubuntu Precise): | |
assignee: | nobody → Colin Watson (cjwatson) |
Changed in grub2 (Ubuntu Raring): | |
status: | Confirmed → Invalid |
Changed in oem-priority: | |
assignee: | James M. Leddy (jm-leddy) → Ara Pulido (apulido) |
Changed in grub2 (Ubuntu Precise): | |
status: | Triaged → In Progress |
description: | updated |
tags: |
added: verification-failed removed: verification-done |
tags: | removed: raring |
Changed in grub2 (Ubuntu Precise): | |
status: | Fix Released → Triaged |
Changed in grub2 (Ubuntu Precise): | |
assignee: | Colin Watson (cjwatson) → nobody |
milestone: | ubuntu-12.04.4 → none |
Changed in grub2 (Ubuntu Trusty): | |
assignee: | nobody → Mathieu Trudel-Lapierre (mathieu-tl) |
Changed in grub2 (Ubuntu Trusty): | |
importance: | Undecided → High |
Changed in oem-priority: | |
status: | Triaged → Incomplete |
Changed in grub2 (Ubuntu Raring): | |
assignee: | Colin Watson (cjwatson) → nobody |
status: | Invalid → Won't Fix |
Changed in grub2 (Ubuntu): | |
milestone: | none → ubuntu-17.03 |
Changed in grub2 (Ubuntu): | |
milestone: | ubuntu-17.03 → ubuntu-17.05 |
Changed in oem-priority: | |
importance: | High → Medium |
assignee: | Ara Pulido (ara) → nobody |
no longer affects: | oem-priority/precise |
no longer affects: | oem-priority/trusty |
tags: | added: oem-priority |
Changed in oem-priority: | |
status: | Incomplete → Won't Fix |
We have to find /boot/grub somehow in the signed memdisk configuration (generated in debian/ build-efi- images, if you're curious), but none of the solutions I initially thought of work here. The filesystems are identical because they were copied, so we can't leave any clues in the file names or contents. Filesystem labels are reserved for sysadmins to set - at least if you're at all sensible - and we can't realistically bake a filesystem UUID into the signed memdisk configuration because we'd then end up changing the UUID of the filesystem containing /boot/grub and that doesn't sound like a great plan.
So, all the cleverer search strategies seem off the table, but EFI does have the Loaded Image Protocol which lets you find out where the image you're running came from. And oh look - GRUB's EFI initialisation code already sets $root from that if it can. I suspect the reason I didn't rely on this is that GRUB only does this for hard disks (which might well be reasonable), but this is in the startup code used on CDs and I needed it to work there as well. I think the right answer is probably something along these lines:
-if ! search --file --set=root /.disk/info; then
- search --file --set=root /.disk/mini-info
+if [ -z "\$root" ]; then
+ if ! search --file --set=root /.disk/info; then
+ search --file --set=root /.disk/mini-info
+ fi
fi
But I need to do some testing to check exactly how the boot process behaves in a few different cases, and possibly add more sanity checking there to make sure that ($root)/boot/grub exists before committing to it.