Ubuntu – Add grub menu for OS X


I installed Ubuntu 16.04 Desktop on my MacBook Pro, and cannot boot OS X now. My disk partition table is:

Device         Start       End   Sectors   Size Type
/dev/sda1         40    409639    409600   200M EFI System
/dev/sda2     409640 392401823 391992184 186.9G Apple HFS/HFS+
/dev/sda3  392402944 490233855  97830912  46.7G Linux filesystem

I added menuentry in /etc/grub.d/40_custom as follows:

menuentry "OS X" {
        insmod hfsplus
        set root=(hd0,gpt2)
        multiboot /boot

and run update-grub, then reboot.

Now I can see entry for "OS X", but when I choose it, it says:

error: disk 'hd0,gpt2' not found.
Press any key to continue...

How can I fix it?

Best Answer

Adding the following codes to /etc/grub.d/40_custom file worked fine for me:

menuentry "OS X" {
    insmod hfsplus
    search --set=root --file /System/Library/CoreServices/boot.efi
    chainloader /System/Library/CoreServices/boot.efi

and then running

sudo grub-mkconfig -o /boot/grub/grub.cfg

Tested on iMac 17,1 (Macbook retina late 2015), Ubuntu 16.04 LTS, Mac OS El Captain