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…

Solution for related problem

(Anonymous) 2013-02-04 04:41 pm (UTC)(link)
I had trouble getting Linux to boot properly on a ThinkStation S30.

The BIOS appears to behave in a similar way to what is described above, only I'd suggest that the Lenovo code just checks for the presence of (at least) "Windows Boot Manager" in the UEFI firmware. It does not seem to force it to load. The Lenovo UEFI implementation in the BIOS for this machine will happily obey the specified BootOrder and load entries that are not labelled "Windows Boot Manager" or "Red Hat Enterprise Linux".

Although the implementation is definitely silly, this might alleviate some of the concerns about having to have an entry "Windows Boot Manager" or "Red Hat Enterprise Linux" that actually points to a GRUB2 loader for another distribution.

I've provided a full description of my findings over on the Lenovo community forums. I'm posting here because this is probably the first article that people with the same problem will see.

https://forums.lenovo.com/t5/ThinkStation/UEFI-Mode-installation-of-Linux-distributions-on-Thinkstation/td-p/1018555

Question re: Linux install issue on m92p

(Anonymous) 2013-08-19 03:26 am (UTC)(link)
I see the m92p is available with Windows 7 as well as 8. Do you know whether the issue with booting Linux is present regardless configuration you order?

The articles I read keep referencing the issue to Windows 8 related UEFI problems and I'd just like to confirm whether its a general issue for this machine, or configuration specific.

Thanks

Re: Question re: Linux install issue on m92p

(Anonymous) 2013-08-28 01:47 am (UTC)(link)
Thanks!

From the BIOS update README...

[identity profile] yuhong.wordpress.com 2014-08-01 09:36 am (UTC)(link)
http://download.lenovo.com/ibmdl/pub/pc/pccbbs/thinkcentre_bios/9sjy81usa.txt

Notice the reference to "redhat 6.3"!

Latest BIOS actually fixes this

(Anonymous) 2023-04-08 07:09 am (UTC)(link)
I ran into this on my Lenovo ThinkCentre M92p: I was only able to boot to UEFI entries labelled "Windows Boot Manager" or "Fedora Linux".

I found that installing the latest bios update from
https://support.lenovo.com/us/en/downloads/ds029265-flash-bios-update-thinkcentre-edge-92-thinkcentre-m82-m92-and-m92p-thinkstation-e31 (as of 2022-04-07, that's version 9SKT9CA released on 2018-12-23) made this stupidity go away, and I could boot from entries regardless of their label.

Page 2 of 2