Skip to content

Dual Boot OSX 10.10 and Ubuntu 14.04 on a 2013 Macbook Pro Retina

2015-06-24 Discuss

Introduction

Why? Some recent benchmarks have shown that Ubuntu can out-perform OSX on Macbook hardware.

This process was tested on a late 2013 Macbook11,2 A1398 model:

  • 2GHz Intel Core i7
  • 16GB 1600 MHz DDR3
  • Intel Iris Pro 1536MB

You can check your Macbook model from Ubuntu like so:

sudo dmidecode --type 1

Issues

Thunderbolt Monitor support is not great. It will work if the monitor is connected to the system at boot-up, but it does not support hot-plug.

Note

See https://blog.jessfraz.com/post/linux-on-mac/ for some new information on this.

Apparently, kernel 3.17 has support for hotplugging Thunderbolt connections.

See http://ubuntuhandbook.org/index.php/2014/11/how-to-upgrade-to-linux-kernel-3-17-4-in-ubuntu-14-10/ for adding 3.17 to Ubuntu 14.

Installing

  1. Prepare Macbook for Ubuntu installation.

    1. Partition hard disk.

      1. Finder > Applications > Utilities > Disk Utility
      2. Macintosh HD > Partition
      3. Add a "Free Space" partition equal to half the drive.
      4. Apply and wait for the file system to shrink (30-60 minutes).
    2. Download a binary zip and install rEFInd Boot Manager. This will allow you to switch between booting OSX 10.10 and Ubuntu 14.04.

      unzip refind-bin-0.8.4.zip
      cd refind-bin-0.8.4
      ./install.sh --alldrivers
      
    3. Download Ubuntu and create a bootable USB stick.

      hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso
      diskutil list
      # find usb disk
      diskutil unmountDisk /dev/diskN
      sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
      diskutil eject /dev/diskN
      
  2. Install Ubuntu.

    1. Reboot, hold down the Option key and choose Ubuntu USB stick.
    2. Grub Boot Menu: Install Ubuntu
    3. Continue with the installation, without networking.
    4. Installation Type > Something Else
    5. This will allow you to create a custom partition configuration and preserve your Mac OSX install.
    6. You should see a partition list like the following:

      Partition Type Size
      /dev/sda1 efi 209 MB
      /dev/sda2 hfs+ 125441 MB
      /dev/sda3 hfs+ 650 MB
      free space 124699 MB
    7. Within the free space, create two new partitions:

      1. Swap space, equal to the same size as system RAM.
      2. An Ext4 partition for the root mount point, consuming the remaining space.
    8. Select the new root partition and continue the installation.
    9. Time Zone: Los Angeles
    10. Keyboard Layout: English (US) - English (Macintosh)
    11. Who Are You? Re-use your existing username and computer name.
    12. Reboot and choose Ubuntu installation from rEFInd menu.
  3. Configure Ubuntu Environment.

    1. Start a Terminal

      1. Ubuntu Search > Terminal
      2. Right-click Launcher Icon > Lock to Launcher
    2. Configure wireless networking.

      1. Insert USB stick with Ubuntu installation media.
      2. Install dkms and bcmwl-kernel-source packages.

        cd /media/`whoami`/Ubuntu\ 14.04.1\ LTS\ amd64/
        sudo dpgk -i pool/main/d/dkms/dkms_2.2.0.3-1.1ubuntu5_all.deb
        sudo dpgk -i pool/restricted/b/bcmwl/bcmwl-kernel-source_6.30.223.141+bdcom-0ubuntu2_amd64.deb
        
      3. Create a network manager wakeup script /etc/pm/sleep.d/99_wakeup and make it executable. This will restore wireless networking when resuming from suspend. Bugs 1299282 and 1289884 are tracking this issue.

        1
        2
        3
        4
        5
        6
        7
        8
        9
        #!/bin/bash
        
        case "$1" in
          thaw|resume)
            nmcli nm sleep false
            ;;
        esac
        
        exit $?
        
    3. Install binary drivers for Intel Iris Pro Graphics 5200.

      1. Download the 64-bit Ubuntu installer from https://01.org/linuxgraphics/
        sudo dpkg -i intel-linux-graphics-installer_1.0.7-0intel1_amd64.deb
        sudo apt-get install -f
        
    4. Disable suspend when closing the lid.

      sudo vi /etc/systemd/logind.conf
      
      HandleLidSwitch=ignore
      
      sudo restart systemd-logind
      
    5. Configure mouse behavior.

      1. System Settings > Mouse and Touchpad
      2. Check: Natural Scrolling
      3. Uncheck: Disable while typing
      4. Uncheck: Tap to click
    6. Disable turning the screen off.

      1. System Settings > Brightness & Lock
      2. Turn Screen Off When Inactive For: Never
      3. Lock Screen After: 10 minutes
    7. Add a screensaver. The default gnome-screensaver is just a black screen.

      sudo apt-get remove gnome-screensaver
      sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
      
  4. Install Applications

    1. Oracle Java 7 and Java 8

      sudo add-apt-repository ppa:webupd8team/java
      sudo apt-get update
      echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
      sudo apt-get install oracle-java7-installer
      
      echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
      sudo apt-get install oracle-java8-installer
      
      # switching versions
      sudo update-java-alternatives -s java-7-oracle
      sudo update-java-alternatives -s java-8-oracle
      sudo apt-get install oracle-java8-set-default
      
    2. Google Chrome

      1. As of version 35, Chrome no longer supports the NPAPI plugin, which is required by the Oracle and OpenJDK Java plugins. If you need to run a Java plugin from a web browser, use Firefox instead.
  5. Test Java version.

    1. https://www.java.com/en/download/testjava.jsp
  6. Test WiFi speed.

    1. Download large files.
      curl -O http://releases.ubuntu.com/14.10/ubuntu-14.10-desktop-amd64.iso
      curl -O http://www.wswd.net/testdownloadfiles/1GB.zip
      

Uninstalling

  1. Reboot into OSX.

  2. Uninstall rEFInd.

    diskutil list
    diskutil mount disk0s1
    sudo su -
    cd /Volumes/EFI
    rm -rf BOOT ubuntu
    
  3. Download GParted Live and install it on a USB stick.

    hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/gparted.iso
    diskutil list
    # find usb disk
    diskutil unmountDisk /dev/diskN
    sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
    diskutil eject /dev/diskN
    
  4. Reboot and hold down the option key.

  5. Remove the Linux partitions.
  6. Reboot into Mac OSX and extend the partition.

    1. Covert the CoreStorage volume back into HFS+.

      diskutil cs list
      diskutil coreStorage revert $VOLUME_UUID
      
    2. Reboot.

    3. Delete the recovery partition.
    4. Extend the primary partition.
    5. Recreate the recovery partition.
    6. Convert the HFS+ volume back to CoreStorage.

      diskutil cs convert "Macintosh HD"
      
    7. Reboot.