[personal profile] mjg59
A (well, now former) coworker let me know about a problem he was having with a Lenovo Thinkcentre M92p. It booted Fedora UEFI install media fine, but after an apparently successful installation refused to boot. UEFI installs on Windows worked perfectly. Secure Boot was quickly ruled out, but this could still have been a number of things. The most interesting observation was that the Fedora boot option didn't appear in the firmware boot menu at all, but Windows did. We spent a little while comparing the variable contents, gradually ruling out potential issues - Linux was writing an entry that had an extra 6 bytes in a structure, for instance[1], and a sufficiently paranoid firmware implementation may have been tripping up on that. Fixing that didn't help, though. Finally we tried just taking the Windows entry and changing the descriptive string. And it broke.

Every UEFI boot entry has a descriptive string. This is used by the firmware when it's presenting a menu to users - instead of "Hard drive 0" and "USB drive 3", the firmware can list "Windows Boot Manager" and "Fedora Linux". There's no reason at all for the firmware to be parsing these strings. But the evidence seemed pretty strong - given two identical boot entries, one saying "Windows Boot Manager" and one not, only the first would work. At this point I downloaded a copy of the firmware and started poking at it. Turns out that yes, actually, there is a function that compares the descriptive string against "Windows Boot Manager" and appears to return an error if it doesn't match. What's stranger is that it also checks for "Red Hat Enterprise Linux" and lets that one work as well.

This is, obviously, bizarre. A vendor appears to have actually written additional code to check whether an OS claims to be Windows before it'll let it boot. Someone then presumably tested booting RHEL on it and discovered that it didn't work. Rather than take out that check, they then addded another check to let RHEL boot as well. We haven't yet verified whether this is an absolute string match or whether a prefix of "Red Hat Enterprise Linux" is sufficient, and further examination of the code may reveal further workarounds. For now, if you want to run Fedora[2] on these systems you're probably best off changing the firmware to perform a legacy boot.

[1] src/include/efi.h: uint8_t padding[6]; /* Emperically needed */, says the efibootmgr source code. Unhelpful.
[2] Or Ubuntu, or Suse, or…

Date: 2012-11-16 01:01 pm (UTC)
From: (Anonymous)
I have a Lenovo W520, and what seems to be happening is that the firmware will ONLY boot the file "/EFI/Boot/bootx64.efi" on the EFI System Partition. It doesn't seem to matter what description you give it, if you rename your .efi boot manager to that exact location and filename, and if the system is set to UEFI boot, it will boot that manager. I've installed rEFInd boot manager and Grub2 boot manager in that location (renaming the .efi files) and both work fine. From rEFInd you can easily boot Windows or Linux .efi files if you put them in the right places for rEFInd to find. The Grub2 was installed by Ubuntu 12.10, which is UEFI and SecureBoot aware. However, Lenovo's firmware didn't like the location Ubuntu had put the file, so it wouldn't boot. Renaming it /EFI/Boot/bootx64.efi works perfectly. Note you have to make sure the disk containing the EFI partition is higher in priority order than any other disk that might boot for it to work automatically.

I'm not saying a string check isn't happening, but the location listed above seems to override any string check.

Date: 2012-11-16 08:09 pm (UTC)
From: [identity profile] cxl [launchpad.net]
Did you add the efi file to the UEFI entries using efibootmgr. If you don't do that, the system will of course always boot "/EFI/Boot/bootx64.efi". As far as I know, no UEFI bios will search for "*.efi" files. You need to add them explicitly by running: sudo efibootmgr --create --loader '\EFI\whatever\grubx64.efi' --label 'My Installed OS'


Matthew Garrett

About Matthew

Power management, mobile and firmware developer on Linux. Security developer at Google. Ex-biologist. @mjg59 on Twitter. Content here should not be interpreted as the opinion of my employer.

Page Summary

Expand Cut Tags

No cut tags