Here you have another possibility, i.e. to bypass completely both grub and rEFInd. By following these steps you'll end up with a system that boots natively into Linux in pure EFI mode.
Whenever you need to boot back into OsX, simply hold down the <alt> key immediately after the chime sound and you'll land in the Apple's built-in boot screen where you can select the OsX partition for booting.
This is the step-by-step guide:
- Once in Linux, download and install by whatever means you prefer the packages mactel-boot and hfsprogs.
- Use GParted, for example, to resize you existing partition schema and make room for a new tiny partition, say, 100MB or less, which you'll format as an HFS+ filesystem. If you have installed hfsprogs, this can be done easily with GParted's GUI or, alternatively, with the command
mkfs.hfsplus /dev/sdaX where X is the number of the newly created partition (I'd assume 7, in your case, i.e. /dev/sda7).
- Mount the new HFS+ partition in whatever mountpoint you may wish. It is not important at all. At the end of the process you can even edit your fstab file to prevent linux from automatically mount this partition upon login.
- Copy your active kernel into this partition. You don't need to copy everything, only vmlinuz-x.y.z-whatever.efi.signed and initrd-x.y.z-whatever.img. IMPORTANT! The kernel must be renamed to something ending with 'efi' otherwise Apple's firmware will refuse to execute its code. You can rename it to vmlinuz-x.y.z-whatever.efi or even simply vmlinuz.efi
- Now create a new boot entry in the EFI firmware issuing the command
sudo efibootmgr -c -l '\vmlinuz-x.y.z-whatever.efi' -L 'Ubuntu' -p X -u "<kernel parameters> initrd=\initrd-x.y.z-whatever.img" where X is the partition number of your brand new HFS+ partition and <kernel parameters> are the parameters as taken from your grub.cfg in the menu entry corresponding to you current boot (e.g. root=UUID=de4567fd-55aa-AND-SO-ON ro quiet splash etc.)
- Bless the the newly copied kernel with the command
hfs-bless "<MountPoint of your HFS+ partition>\vmlinuz.efi" (e.g.
- Done. Reboot and enjoy.
The main advantage of this approach is the blazing fast boot time. You can be in your login screen within a handful of seconds, depending on your hardware's speed. You can even eliminate the default 5 seconds delay using
sudo efibootmgr -T
On the other hand, one major drawback is that each time you update the kernel you need to manually update the (at this point, hidden) HFS+ partition. If you don't do that, it won't harm much since you'll be booting with an old kernel. Nevertheless, an update is advisable, and it could be done automatically by using some form of shell script.
Another (potential) drawback is that on some machines, X may fail to correctly detect your graphic card when booting the kernel directly.