There is a better way of single installation of Ubuntu on Macs without rEFInd using Mac's bootloader.
Create a live USB containing Ubuntu. Do not use the
+mac version since it does not support EFI boot.
Boot from the Live USB. The trick to booting from USB on Macs is to hold down the
option key as soon as you power on the device. Select EFI Boot from this menu.
Ubuntu should now boot up from the USB. Install Ubuntu using the Erase and use Entire Disk option.
Firstly, when you reboot/power on your Mac, you will see the grey screen of the Mac bootloader for about 30s, and then a gently flashing folder with a ? inside. If you insert the installer USB now, it should boot. If not, try holding the power button to force the power off, and then follow the USB booting instructions to bring it up.
If you’re using the desktop installer, hold the
shift key to bring up the GRUB bootloader menu.
Don’t select any of the entries. Instead, press C to bring up the GRUB console.
At the grub console, type
(memdisk) (hd0) (hd0,msdos) (hd1) (hd2) (hd2,gpt3) (hd2,gpt2)
You may not get exactly the same results as this, but you’ll have some similar options.
Now, find the partition which contains your user's home directory.
grub> ls (hd2,gpt2)/home
Keep trying until you find it.
The result from the last step has two parts:
(hdX,gptY). You need to keep the
hdX part, but go through all the
gptY options looking for a /boot/grub directory.
grub> ls (hd2,gpt2)/boot/grub
unicode.pf2 [...] grub.cfg
Now you want to set this as your root for further commands.
grub> set root=(hd2,gpt2)
The only way to boot properly was to use the UUID of the drive. To get it -
grub> ls -l (hd2,gpt2)
Note down the UUID. You'll have to type it manually in the next step.
grub> linux /boot/vmlinuz〈...tab here!...〉.efi.signed root=UUID=〈the
UUID from above〉
The GRUB console can do tab completion, so if you just type out the vmlinuz part and hit
tab, then hit . and
tab again, you won't have to type the whole file name. make sure that the
efi.signed part is present.
Now, set the initial RAM disk
grub> initrd /boot/initrd〈...tab here!...〉
You should be able to boot with the command
The system was initially unbootable because the Mac bootloader expects the EFI partition to be formatted as HFS+, the typical Mac filesystem, while the Ubuntu installer actually formats it as VFAT.
Now, open a terminal and type
sudo add-apt-repository ppa:detly/mactel-utils
sudo apt-get update
sudo apt-get install mactel-boot hfsprogs gdisk grub-efi-amd64
mount to get a list of mounted filesystems, and look for anything mounted at /boot/efi. Unmount it.
sudo umount /dev/sda1
We now use
gdisk to delete the VFAT partition and create an HFS+ one,
sudo gdisk /dev/sda
Confirm that the first partition has type
EF00. Now we delete that
Create a new HFS+ one in its place.
enter key for the first and last sector options.
AF00 for the filesystem code.
p command to double-check your changes, and then
w to write.
Now we have an unformatted HFS+ partition. We can format it with -
sudo mkfs.hfsplus /dev/sda1 -v ubuntu
Delete the lines that refer to /boot/efi using
Now, type the following commands -
sudo bash -c 'echo $(blkid -o export -s UUID /dev/sda1) /boot/efi auto defaults 0 0 >> /etc/fstab'
sudo bash -c 'echo "This file is required for booting" > /boot/efi/mach_kernel'
Install GRUB and 'bless' the filesystem.
sudo grub-install --target x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi
sudo hfs-bless "/boot/efi/System/Library/CoreServices/boot.efi"
To set the default efi boot entry, run
Get rid of the extra entries -
sudo efibootmgr -b xxxx -B
where xxxx is the boot number obtained from
Now, set the default entry -
sudo efibootmgr -o xxxx
Lastly, install the
linux-signed-generic meta package -
sudo apt-get install linux-signed-generic
This will make sure that any kernel updates also include the cryptographically signed kernel image required by EFI. Without this, your machine may freeze during boot. If that happens, refer to the instructions above for manually booting via grub.
The system should now be bootable!
(Adapted with modifications from Jason Heeris' post)