The Slightly Disgruntled Scientist

...now 7% more viral!


Ubuntu + Mac: Pure EFI Boot (Short Version)

This is the condensed version of a longer tutorial. If the commands here don't work, or if you don't understand them, please read the longer one.

Do not use the +mac version of the installer!

In OS X:

  • Mute internal speaker volume (if desired)
  • Make recovery disk

To boot from USB: hold option/alt when powering on. Some keyboards require tapping it.

To start the Ubuntu installer, select EFI boot from the Mac boot menu.

Installation can proceed as normal, but make sure there’s an EFI boot partition.

To manually boot into the new system, bring up the GRUB console and do:

grub> linux /boot/vmlinuz«tab».efi.signed root=UUID=«the UUID of the drive with /boot»
grub> initrd /boot/initrd«tab»

To fix the EFI partition, install these packages:

$ sudo add-apt-repository ppa:detly/mactel-utils
$ sudo apt-get update
$ sudo apt-get install mactel-boot hfsprogs gdisk grub-efi-amd64

Format the partition:

$ sudo umount /dev/sda1 # Replace /dev/sda1 with your EFI partition node!
$ sudo gdisk /dev/sda

gdisk commands:

Command (? for help): d
Partition number (1-3): 1

Command (? for help): n
Partition number (1-128, default 1): 1
«accept defaults»

Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): AF00
Changed type of partition to 'Apple HFS/HFS+'

Command (? for help): w

Format the partition:

$ sudo mkfs.hfsplus /dev/sda1 -v Ubuntu

Update /etc/fstab by removing any lines relating to /boot/efi and doing:

$ sudo bash -c 'echo $(blkid -o export -s UUID /dev/sda1) /boot/efi auto defaults 0 0 >> /etc/fstab'

Remount the partition:

$ sudo mount /boot/efi

Install GRUB:

$ sudo mkdir -p "/boot/efi/EFI/$(lsb_release -ds)/"
$ sudo bash -c 'echo "This file is required for booting" > "/boot/efi/EFI/$(lsb_release -ds)/mach_kernel"'
$ sudo bash -c 'echo "This file is required for booting" > /boot/efi/mach_kernel'
$ sudo grub-install --target x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi --bootloader-id="$(lsb_release -ds)"
$ sudo hfs-bless "/boot/efi/EFI/$(lsb_release -ds)/System/Library/CoreServices/boot.efi"

Replace bootloader icon:

$ sudo apt-get install mactel-boot-logo
$ sudo cp /usr/share/mactel-boot-logo/ubuntu.icns /boot/efi/.VolumeIcon.icns

Fix the boot delay by finding any old bootloader entries with efibootmgr:

$ sudo efibootmgr
BootCurrent: 0000
Timeout: 5 seconds
BootOrder: 0080
Boot0000* ubuntu
Boot0001* Ubuntu 14.04.1 LTS
Boot0080* Mac OS X
BootFFFF*

Decrease timeout:

$ sudo efibootmgr -t 0

Remove extra entries and set defaults:

$ sudo efibootmgr -b 0000 -B
$ sudo efibootmgr -b 0080 -B
$ sudo efibootmgr -o 0001

Comments Disabled

Comments are disabled for this, because (a) if this doesn't work, you should read the longer version in case the details help, and (b) I want to keep any discussion in one place.