I wish to completely remove OS X from my Mac and single install Ubuntu 14.04 LTS.
Although I wish to use the newer EFI boot method instead of the legacy BIOS boot, I do not want to use rEFInd or any other third party bootloader but instead, I want to use the Mac's default bootloader.
The reason for this is that I want to eliminate the approximately 30 second delay caused by other known methods and also wish to get access to various EFI related utilities.
Can you provide a detailed and step by step method in order to achieve this?
Best Answer
This process will wipe OS X and any other data you have on the machine. Please make sure to backup your system before proceeding.
You may wish to create a recovery disk so that you may restore OSX at a later date, if required.
Create a Live USB with Ubuntu
Refer to this page for detailed instructions. UNetbootin is recommended since it is cross plaform and provides a Graphical User Interface (GUI).
NOTE - 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.
Boot Manually from Your Hard Drive
At this point the system is 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.
In this step we'll instruct GRUB on the Live USB too boot off of your newly installed Ubuntu on the hard drive. – This will requires some serious typing, but after having booted this way we'll be ready to set up automatic boot in the next step.
If you’re using the desktop installer, hold the
shift
key to bring up the GRUB bootloader menu.When you see the GRUB boot menu, don't select any of the entries. Instead, press
C
to bring up the GRUB console.At the grub console, type
ls
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.
Keep trying until you find it.
The result from the last step has two parts:
(hdX,gptY)
. You need to keep thehdX
part, but go through all thegptY
options looking for a /boot/grub directory.Now you want to set this as your root for further commands.
The only way to boot properly is to use the UUID of the drive.
Note down the UUID. You'll have to type it manually in the next step.
The GRUB console can do tab completion, so if you just type out the vmlinuz part and hit
tab
, then hit . andtab
again, you won't have to type the whole file name. make sure that theefi.signed
part is present.Now, set the initial RAM disk
You should be able to boot off your hard drive the command
Setting up Automatic Boot
You have now booted into your newly installed Ubuntu. Next step is to make boot automatic and pain free, by reformatting the
/boot/efi
partition to the HFS+ file system that Mac expects, and allowing you to boot straight off of it.1. Installing Extra Packages
Now, open a terminal and type
2. Reformatting the EFI Partition
Run
mount
to get a list of mounted filesystems, and look for anything mounted at /boot/efi. Unmount it.We now use
gdisk
to delete the VFAT partition and create an HFS+ one(Note that there is NO number at the end of that disk name!)
Press
p
Confirm that the first partition has type
EF00
. Now we delete thatEF00
partition.Press
d
Create a new HFS+ one in its place.
Press
n
Press enter for the first and last sector options.
Enter
AF00
for the filesystem code.Use the
p
command to double-check your changes, and thenw
to write.Now we have an unformatted HFS+ partition. Format it with:
3. Updating the Filesystem Table
Edit /etc/fstab
Delete the lines that refer to
/boot/efi
usingCtrl+K
.Now, type the following commands -
4. Installing GRUB on the HFS Partition
Install GRUB and 'bless' the filesystem.
EDIT Some Troubleshooting: When following these instructions on Ubuntu 14.04 Trusty Tahr, I got the following error message from
grub-install
After running it again with
strace
I determined that it wasn't looking for a file called/boot/efi/mach_kernel
, but a file called/boot/efi/EFI/ubuntu/mach_kernel
and after creating that file, and re-runninggrub-install
everything seems to work. END EDIT5. Removing the Boot Delay
To set the default EFI boot entry, run
Get rid of the extra entries -
where xxxx is the boot number obtained from
sudo efibootmgr
Now, set the default entry -
The system should now be bootable!
CREDITS
Jason Heeris - For his original post, the PPA used.
Rohith Madhavan - For the post on Ask Ubuntu, minor modifications.