Linux

Install ubuntu 16.04 on a mac book pro in dual boot

Tired to use Mac OS for development purposes, I wanted to install Ubuntu 16.04 in dual boot on my Mac book pro retina 15.6″. For that I needed :

  • A mac book pro with an intel processor
  • A bootable USB stick with ubuntu 16.04
  • The Disk utility from mac OS
  • The rEFInd boot manager
  • A RJ45 adapter, because Wifi does not work at once
  • Some tunnings

First, I MADE A BACKUP ! It is a little scary to touch the boot sequence, so it is mandatory to prevent bad operations.

STEP 1 : Create a bootable ubuntu USB stick : For that I used the “Startup Disk Creator”, there is a nice tutorial here

STEP 2 : Reboot the mac in recovery mode, that is by powering the mac and pressing at once Command + R

STEP 3 : Choose the disk utility (last choice in the list)

STEP 4 : In my case, I needed to repair my disk before re-partitionning it : otherwise I had a “Partition failed … because verification failed” message. I went to SOS tab and selected the right disk in the side list : I first selected the disk itself, but it is useless : I had to click on the main partition (just below the disk), then the repair button found and repaired the filesystem. May be you won’t have to do this, the better is, at least, to push the verify button to be sure.

STEP 5 : Re-partition your disk : I went to the “partition” tab, clicked on the main partition rectangle and then clicked the “+” button, selected the new partition that has been added and re-clicked on it and on the “+”. Finally, I obtained 2 new partitions for my future ext4 “/” and swap. By clicking both partition, one can choose their size, name and the filesystem. On my 512 GB drive, I have chosen 120GB for “/” and 8GB for the swap, for the filesystem I have chosen a FAT. You must click on the apply button to make new partitionning effective.

STEP 6 : Boot on Ubuntu USB stick, to do so, reboot the Mac and keep pressed the “option” key : it will go to the mac boot manager : choose the third choice to boot on usb stick.

STEP 7 : Install Ubuntu : it is like a normal installation : On grub menu, I clicked on “install Ubuntu” then, it is important to do a manual installation : you have to choose “something else” in installation type and choose to install an ext4 for “/” and the swap on the good partition. I checked that only these partitions are marked as to be formatted (means the filesystem to be created). If asked, you have to select the right keyboard in the list : choose the “Macintosh” variation.

STEP 8 : Install the right boot manager : If you restart your mac, you will notice that you won’t be able to boot ubuntu yet. Even by pressing option key : the ubuntu partition is not seen by Mac boot manager. I had to install rEFInd boot manager : download it from source forge : https://sourceforge.net/projects/refind/ , extract the archive and run the install script in a terminal : sudo ./refind-install and that’s all.

STEP 9 : Reboot the mac : you will see a new boot screen where you have to choose what to boot : choose ubuntu. You have a brand new ubuntu desktop. Unfortunately, that’s not finished : The wifi is not working and the screen brightness keys are not working.

STEP 10 : As wifi is not working, I had to plug in a RJ45 cable on my Mac. Then I went to the “Additional drivers” ubuntu application :

STEP 11 : I installed the nvidia and Broadcom (wifi) drivers from that application. For Broadcom I installed before this debian package : firmware-b43-installer but I am not sure it is mandatory.

STEP 12 : The nvidia driver solved only half of the screen brightness problem : the brightness keys are detected but brightness was not changing, I had to add this magic and strange line into the /etc/rc.local script :

STEP 13 : Reboot to ubuntu, everything should be fine now… But if you do, like me, an upgrade of all package to be up-to-date ( apt update and apt upgrade ), it will update Grub and that will erase the rEFInd boot manager : I was only able to boot ubuntu, no more access to MacOS

STEP 14 : Fortunately, you can reinstall rEFInd boot manager from ubuntu :

Now you can play with Ubuntu and MacOS at the same time.