Monday, October 17, 2011

Problems with the Thinkpad X220 and GPT, UEFI, MBR and Legacy BIOS Booting

Crucial M4 SSD Thinkpad X220 7mm ModAfter several days banging my head against a brick wall and suffering the indifference of Lenovo/IBM tech support I have learnt a lot about UEFI, in regards to the X220 in particular.
  1. The X220 cannot/will not boot GPT disks using Legacy BIOS. I would call this a bug.
  2. The X220 will not boot /efi/*/*.efi unless "signed"(?) into BIOS, you have to copy it to /efi/boot/bootx64.efi. I guess this is a security feature, but I'm not sure how secure it is if you can bypass it so easily.
  3. Disabling the BIOS setting "USB UEFI BIOS Support" disables *all* USB booting, ie, both UEFI and legacy BIOS. If this isn't a bug then
    1. it at least needs relabelling,
    2. could be moved/linked to the boot menu and
    3. is redundant as you can disable USB booting using the Boot menu.
I should say that this was with BIOS version 1.22 (I think).

I recommend following these instructions to create a very useful and versatile boot disk for diagnosis.

If you want to use the X220 UEFI boot menu I recommend disabling booting from LAN as it adds a few seconds to the boot time. You have to disable it in several places in the BIOS to avoid the wait.

See also my more general post on Arch Linux on the X220.


Unknown said...

Jamie, I just spent some time developing an automated Arch install script for a pure EFI setup on my own x220 tablet. At minimum there only need to be two partitions in my setup, and the EFI boot partition doesn't need an EFI directory anymore. It took me a while to get to this point and you might already be aware of this method, but I thought it would be good for those that find you blog to stumble on the relevant forum thread as well.

The script thread is on the Arch BBS:

and the actual script is on github:

Jamie said...

To be honest I think it would have been fine if I'd just started with the archboot install disk, as I could have used UEFI from the beginning. The problem was that I was moving my current installation from BIOS to UEFI.

btw, does anyone really use swap any more? Especially on SSDs?

Unknown said...

I have the same situation as you did, back into June 2011. I managed to write it on my blog which is in Chinese language but I found its so complicated to explain them all.
My solution was no solution and I had chose to move all my GPT partitions to legacy BIOS partitions.

I used Intel M2 SSD on my Thinkpad Edge 14. And I later bought X220 and migrated the SSD to my X220. I have been like you consider to use eSATA SSD and to keep the harddrive. But there were not to many eSATA SSD in the market.

Unknown said...

I've been trying to get Gentoo to boot as UEFI on my X220 tablet for the past few weekends. My system dual-boots with Windows in UEFI mode and I have all the legacy BIOS options turned off (I think). I originally tried using an uncompressed vmlinuz kernel with the EFI stub loader and inserting kernel arguments with efibootmgr but that rendered the entire box unbootable (even from external media and legacy BIOS!) until I hit "restore defaults" in the boot tab of the firmware setup. I tried again with rEFInd but neither their binary nor one I compiled were bootable. Selecting rEFInd from the F12 boot device menu just blanks the screen and quickly flips back to the boot menu.

Would you comment a bit more on needing to "bless" the kernel .efi? Just run it for a single boot as bootx64.efi and then move/rename it to something else for the dual boot case? I suspect this may be my problem.

Jamie said...

I'm a bit confused as to what your problem is as you say that your system dual boots. Do you mean it doesn't boot without Windows?

Unknown said...

The desired end result is that I'm presented with the option of booting into either Windows or Gentoo at power-on. I'm using the term "dual boot" to refer to that configuration but you're correct that that's not what I have now.

What I have now is a Windows installation and a Gentoo installation on separate partitions of the same drive. Windows Loader is located at EFI/Boot/bootx64.efi and has an entry in the F12 boot menu as "Windows Loader". Simply powering on the machine starts Windows automatically. Hitting the ThinkVantage button during early startup, pressing F12, and selecting "Windows Loader" from the boot menu also starts Windows without incident.

I have an uncompressed Gentoo kernel with EFI stub loader compiled in as well as an uncompressed initramfs installed at EFI/Gentoo/vmlinuz.efi. I attempted to manually create a boot menu entry using efibootmgr but that ended disastrously as mentioned before. I created a "refind-linux.conf" file with my kernel arguments which is supposed to get picked up on by rEFInd if I can ever get it to run. There is currently not an entry in the F12 boot menu for booting this kernel directly.

I have rEFInd boot manager installed at its default location of EFI/refind/refind.efi. Its install script created an entry in the F12 boot menu labeled "rEFInd Boot Manager". Selecting this entry blanks the screen momentarily and kicks me back to the F12 boot menu. The desired effect is to launch rEFInd and at least be presented with a user interface letting me know what else is wrong.

I am at the point where doing the things in the various manuals and following the various HOWTOs to the letter does not work. Reading your blog post, it sounds like the X220 has UEFI implementation quirks that I need to be aware of and work around. You mention that you needed to place your kernel at EFI/Boot/bootx64.efi for at least one startup to get it "signed". I interpret "signed" as being flagged as bootable and subsequently relocatable to elsewhere in /boot/EFI/. Is that correct?

Jamie said...

I don't know anything about EFI stub loaders or rEFInd, but I do recommend a boot manager that will allow you to configure boot options without having to mess about with the BIOS boot menu. Overwrite the Windows EFI/Boot/bootx64.efi with the bootloader .efi boot file and this should get your machine to boot straight into the bootloader. Following the instructions in the linked post to create USB boot media is very informative and helps a lot with diagnosing problems.