Matthew Garrett ([personal profile] mjg59) wrote2012-11-14 11:49 pm
Entry tags:

More in the series of bizarre UEFI bugs

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…

Re: Lenovo W530

(Anonymous) 2013-05-13 02:15 am (UTC)(link)
I have a Lenovo Ideapad Z580. It came with Windows 8 (not required by me for any purpose whatsoever), and I dual-booted with Ubuntu Linux 12.04.2 LTS. Upon starting the laptop every morning, it just goes into a blank screen. There are some solutions, however, none of them permanent as yet. My line of action now, is to totally get rid of whatever Windows 8 has, partitions, etc, and do a clean install of Ubuntu 12.04.2. Unless some solution does come up. BTW, Lenovo support in India also stated that if anything other than Windows 8 is found on the laptop, the warranty is void. They also did not offer option to downgrade Windows 8 to Windows 7. M$ does not sell Windows 7 anymore to normal Indian consumers anymore.

Re: Lenovo W530

(Anonymous) 2013-05-24 05:31 pm (UTC)(link)
Finally, managed to get Ubuntu 12.04.2 LTS off the laptop and installed Fedora 18 on it. No problems with Fedora on the Z580, except that Wireless LAN disconnects very frequently and the Bluetooth does not connect to my phone. Now have downloaded Xubuntu 13.04 and will try that out to see if the Ubuntu 12.04.2 LTS ACPI issues do not occur, the random booting black screens do not occur, and we over the Fedora 18 wireless LAN and bluetooth issues.

Re: Lenovo W530

(Anonymous) 2013-05-26 11:13 am (UTC)(link)
Xubuntu 13.04 works like a dream on the Lenovo Z580. Will wait for Fedora 18's next release. On Fedora 18, the Wireless LAN adapter and Bluetooth were not recognized.