The version of grub2 (1.99) in Ubuntu 12.04 has a bug that results in grub2 failing to boot on certain systems when they boot in UEFI mode. After investigating and working with the grub maintainers, we isolated it to a behavior of the BIOS in PowerEdge 12G systems, although one of our BIOS engineers also found that the UEFI reference implementation from Intel (TianoCore) exhibits the same behavior, albeit on a smaller scale. Patches now exist for both grub 1.99 and grub 2.00, the later of which will be available in Ubuntu 12.10. Unfortunately, the grub2 packages in Ubuntu 12.04 have not yet been patched to fix this bug, so installing Ubuntu 12.04 on a Dell system in UEFI mode requires some manual workarounds to install the system and then later install a grub 2.00 backport from Quantal.

We have asked for an updated grub2 to be included in Ubuntu 12.04, including the installer. Until 12.04 is updated, if you need to use Ubuntu 12.04 in UEFI mode on your 12G system and can use BIOS mode during installation, you can follow this summary of how to install from BIOS mode and later switch to UEFI mode.

Please note that this is only meant for advanced users and is not supported by Dell. It is also possible to modify the install media for Ubuntu to use a patched grub2 so that the media boots, but those steps are not included in this blog post. A follow-on post by my colleague Stuart Hayes addresses using modified boot media to install directly from UEFI mode.

To install in BIOS mode and then switch to UEFI mode, you can follow this summary of steps. I would like to reiterate that this procedure is only meant for advanced users.

  • Boot the system into the BIOS setup (F2 at boot) and make sure that your system is set to boot in BIOS mode.
  • Setup the boot disk partitions. You will probably want to switch to a console in the installer and use parted to do this:
    • Have /boot/efi as the first partition (e.g. /dev/sda1) with a size of 200MB, formatted as vfat and flagged as bootable.
    • The rest of the disk normal should be laid out as usual (e.g. /dev/sda2 as /boot, and / and swap in an LVM volume on /dev/sda3).
  • Proceed with the install but, before rebooting out of the installer, chroot into the installed system.
    • Install the grub 2.00 packages that, at the time of this writing, are available from Ubuntu Core developer Colin Watson's PPA:

 deb http://ppa.launchpad.net/cjwatson/grub/ubuntu precise main 
 deb-src http://ppa.launchpad.net/cjwatson/grub/ubuntu precise main

    • Run grub-mkimage. I used "grub-mkimage -O ${EFI_ARCH}-efi -d . -o grub.efi -p "" part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot configfile linux multiboot". You should verify that you do not need any other grub2 modules for your system configuration.
    • Run "mkdir /boot/efi/EFI/ubuntu".
    • Copy /usr/lib/grub/x86_64-efi and grub.efi (the latter from grub-mkimage output) to /boot/efi/EFI/ubuntu.
    • Run "update-grub". Copy /boot/grub/grub.cfg to /boot/efi/EFI/ubuntu/.
    • Edit /etc/fstab to have an entry for /boot/efi. You can get the UUID for this partition from "ls -l /dev/disk/by-uuid".
  • Reboot. During POST, press F2 to enter the system setup and switch to UEFI boot mode.
  • Exit the BIOS setup and select F11 during POST to run the UEFI boot manager. In the UEFI boot manager, choose the option to select a boot file. Navigate to your disk and find /boot/efi/EFI/ubuntu. Boot to grub.efi in this directory. If, in your configuration, you are brought to the grub command line, you may need to set the configfile, such as with "set configfile="(hd0,gpt1)/EFI/ubuntu/grub.cfg"" (note the double-quotes after the "=") followed by "boot".
  • Once successfully booted into the install system, uninstall all grub packages, and remove the /boot/efi/EFI directory and its contents. Reinstall the grub 2.00 package from the PPA above.
  • Run grub-install (e.g. "grub-install /dev/sda") and update-grub.
  • You should now be able to boot into your system in UEFI mode.