Ubuntu 14.04 GPT EFI faiL

I installed Ubuntu 14.04 and ran into a problem.  Starting with the default 64 bit version using pretty straightfoward settings as a new installation, I ended up with this terse message after the installation completed:

Operating system not found

It turns out that the laptop (a 2 year old lenovo) can only boot from EFI and GPT under a narrow set of conditions, roughly equal to “are you booting the original installation of windows from the original disk”.  GPT is a new partitioning scheme for disks bigger than 4Gb, and EFI is a booting scheme for storing the operating system boot files on those partitions. This means that the system does not boot by running the code from the first sector of the hard disk (the master boot record, MBR). Instead it loads files and things like that in a FAT-32 GPT partition. The BIOS of the computer I used has some kind of bug that causes EFI booting to fail.  Ubuntu 14.04 has enabled EFI booting and GPT partitioning by default, which kinda breaks things.

The fix is:

  1. Boot a rescue system and chroot into the installed system
  2. Use gdisk to convert the GPT partition table to the standard old MBR
  3. Run grub-install /dev/sda  (well, maybe /dev/sdb, because you might be booting a rescue system from a USB stickie).
  4. Reboot

However, I first tried at least some of these:

  • Retry (did I select some odd option during installation)
  • Custom partitioning without GPT (Ubuntu 14.04 has hidden full system encryption so that it doesn’t work in custom partitioning)
  • GRUB installed on the MBR (but GRUB 0.97 which is non-EFI does not know how to read its data from a GPT partition).
  • BIOS flash updates: these are provided as an ISO image that you can burn to CDROM … but the system has no CDROM drive.  I wasted lots of time fiddling with various projects that profess to be able to boot an ISO image from a flash drive, but didn’t to do so for me.  The program that showed the most promise was unetbootin, and that got stuck on its boot loader, and didn’t boot the “bootable” ISO.
  • LILO: this uses a block list, so it can boot anything anywhere … but this system needs to survive a kernel upgrade, and I’ve never tested Debian’s support for LILO in kernel updates. (Didn’t even try it.)

I finally found gdisk referenced on stackexchange – and that did the trick:

$ gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.7

Command (? for help): ?
b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu

Command (? for help): r

Recovery/transformation command (? for help): ?
b use backup GPT header (rebuilding main)
c load backup partition table from disk (rebuilding main)
d use main GPT header (rebuilding backup)
e load main partition table from disk (rebuilding backup)
f load MBR and build fresh GPT from it
g convert GPT into MBR and exit
h make hybrid MBR
i show detailed information on a partition
l load partition data from a backup file
m return to main menu
o print protective MBR data
p print the partition table
q quit without saving changes
t transform BSD disklabel partition
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu

Recovery/transformation command (? for help): g

This is the second failure of Ubuntu 14.04 in as many days (two days, not 14 days) — the other failure is that it simply will not install on machines without PAE support. (And I always thought that PAE was strictly optional.)

This entry was posted in Stuff and tagged , , , , , , , . Bookmark the permalink.