Triple boot on a Mac with OSX, Windows 10 and Ubuntu Linux 16.04

Abstract

As a network and security architect, I sometimes need to test security and network policies using different OS. A virtual machine can help but what if you need to test policies against physical hardware?

I have a 250GB SSD, and I’m going to allocate:

  • 50GB for OS X
  • 50GB for Windows
  • 150GB for Ubuntu Linux 16.04, my preferred OS

I made lot of tests to make everything working fine, so be sure you follow the steps below carefully.

Mind that you’ll need three USB keys:

  • Windows 10 installation
  • Windows 10 recovery
  • Ubuntu 16.04 installation

Install or prepare OS X

If you have a OSX installed on a single partition, filling the whole disk, go to the next step below in this paragraph.

Otherwise, I suggest to reinstall OS X:

  • power off your Mac;
  • keep pressing command + R while you power on your Mac (release when the apple disappear) and boot into macOS Recovery mode;
  • OS X Utilities will be loaded:

OS X Utilities

  • open Disk Utility, select your main disk and press erase (do that more than once, if first attempt fails);
  • name your new partition OSX;
  • quit Disk Utility;
  • open Install OS X and install it.

When installation is completed, consider to upgrade your OS X to latest version. After that:

Install Windows

At the end of this section, you will have a dual boot Mac: OS X and Windows 10. You can boot one OS using Startup Manager or via Boot Camp.

Let’s begin:

  • insert the Windows installation USB key;
  • power on holding option/alt to open the Startup Manager;
  • boot from Windows installation USB key;
  • in the disk manager, remove the non OS X partition (remove the second one, the bigger one);
  • create a new 50GB partition and install Windows on it;
  • be sure Boot Camp package is installed too (it contains Mac drivers for Windows);
  • create a Windows USB recovery drive;
  • power off your Mac.

Installing ReFind

At the end of this section, we’ll install a new bootloader to better manage a multi OS Mac.

Let’s begin:

  • keep pressing command + R while you power on your Mac (release when the apple disappear) and boot into macOS Recovery mode;
  • OS X Utilities will be loaded;
  • open Disk Utility and mount OS X partition;

[Image]

  • quit Disk Utility;
  • open a terminal and install rEFInd (continue even if you got a warning):
# cd /Volumes/OSX/Users/andrea/Destkop/refind-0.10.2
# ./refind-install
  • power off your Mac.

Install Ubuntu Linux

At the end of this section, you will have a dual boot Mac: OS X and Ubuntu Linux 16.04. Windows 10 will be broken by Ubuntu installation.

Let’s begin:

  • insert the Ubuntu installation USB key;
  • power on holding option/alt to open the Startup Manager;
  • boot from Ubuntu installation USB key;
  • install Ubuntu using the free space (about 150GB);
  • power off your Mac.

Fixing Windows 10 boot (0xc000000e error)

After Ubuntu installation, Windows 10 won’t boot anymore. Boot will will fail with 0xc000000e error. Fixing that was the hardest part of this journey.

0xc000000e Windows 10 error

Let’s see how to fix it:

  • power on your Mac and boot Ubuntu;
  • login, open a shell with administrative privileges;
  • edit /boot/efi/EFI/refind/refind.conf and include gptsync:
showtools shell, gdisk, memtest, mok_tool, apple_recovery, windows_recovery, about, reboot, exit, firmware, fwupdate, gptsync
  • reboot your Mac and select Hybrid MBR tool (gptsync) from rEFInd boot loader;
  • gptsync should detect four partitions:
    • EFI PRotective
    • NTFS/HPFS
    • Linux
    • Linux swap / Solaris
  • confirm gptsync you want to sync MBR and GPT;
  • power off your Mac;
  • insert the Windows USB recovery drive;
  • power on holding option/alt to open the Startup Manager;
  • boot from Windows USB recovery drive;
  • open a command prompt and type:
bootrec /scanos
bootrec /rebuildbcd
bootrec /fixmbr
bootrec /fixboot
  • power off your Mac.

You can now boot:

  • OS X
  • Ubuntu
  • Windows 10 using legacy mode only

References

Posted on 15 Feb 2017.
  • Gmail icon
  • Twitter icon
  • Facebook icon
  • LinkedIN icon
  • Google+ icon