Installing Ubuntu 13.04 on 13″ Macbook Pro Retina (10,2)

A couple of weeks ago, I purchased the 13″ Macbook Pro Retina. I spent a long time thinking about the purchase because I wanted something that would work well with Ubuntu and had at least 1080p and 8GB RAM. Since I’ve bought it, I gave OSX a try in the hopes that it will be usable for development since I’m almost exclusively on Ubuntu for the last several years. I think it’s definitely usable but it’s hard to change old habits so I installed Ubuntu on the Macbook. The following is my process, my mistakes and what I’ve learned.

1. Partition

The first step is pretty simple.  You can resize the Macintosh partition using the OSX Disk Utility.  I resized the partition to 88GB and left the rest as free space.

2. Create USB Installer

You should follow the directions http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx to create a 64-bit Ubuntu USB startup drive.
At the end of the instructions, you’ll see an error message indicating that OSX isn’t able to read the drive.
Screen Shot 2013-10-30 at 9.20.37 PM
Don’t worry, this is normal and it should still work as a USB installer but you just won’t be able to read/write to the drive itself.

(OPTIONAL but RECOMMENDED) Since you won’t be able to read/write to this drive, if you have another USB stick handy, you should upload the wifi driver to the 2nd USB stick.  After the Ubuntu installation, wifi will not work and you will need to install the driver and its 3 dependencies to get it working.

3. Install Boot Manager

I used rEFInd as the boot manager instead of rEFIt.  It seems to work for me.  You can find it here: http://www.rodsbooks.com/refind/getting.html and download the binary zip file.  Once downloaded and unzipped, open a Terminal window and install:

cd ~/Downloads/refind-bin-0.6.7  
 ./install.sh 

4. Install Ubuntu

Here comes the fun part.  Insert your Ubuntu USB installer and restart your computer.  When the computer restarts, you should see your new boot manager screen with an Apple and a triangle shaped icon for the Ubuntu installer.  Right arrow over to the installer and hit Enter to select it.  This will load the typical Ubuntu installer.  Select “Install Ubuntu”.  If this is the first time you are installing Ubuntu, it should give you the option to install Ubuntu alongside Mac OSX.  If you are reinstalling over a bad installation, it will give you the option to erase Ubuntu only and reinstall.  WARNING! If you are attempting a reinstall and select this option, the previous swap partition will not be reused or erased.  A new one will be created meaning you will lose about 8GBs of space for nothing.  Instead of having the installer create the partitions for you, initial install or reinstall, I recommend selecting the “Something else” option and create your own partitions.

If you select “Something else” you will see a screen with a list of partitions.  If this is a reinstall, scroll to the bottom of the list and delete the previous install’s paritions.  At the very bottom of the list is “Free space”.  Select that and click on the “+” sign to create a new partition.  You can create a root “/” using ext4 with a size of about 25GB.  Next, create a swap partition with a size around 8 to 16GB.  Finally, create an ext4 home “/home” partition with the rest of the remaining space and continue with the installation.  After the installation, it will ask you to reboot and you should do so.  If you get a blank screen after the message, just hit the space bar and it will continue.

5. Setting Up WIFI

After you restart, you should see a Ubuntu logo, an Apple logo and the Linux penguin.  You may also see the diamond shaped logo if your USB stick is still plugged in.  If you didn’t have a 2nd USB stick, you will need to get the wifi drivers.  Select the Apple logo to boot into Mac OS, format the USB installer so it can be read and copy the drivers from the link above onto the USB stick.  Reboot.

When you have your wifi drivers, select the penguin, NOT the Ubuntu logo.  If you select the Ubuntu logo, I think it will go to the grub rescue screen and I had to hold down the power button to reboot again.  After selecting the penguin, you should see the normal GRUB menu on the left hand side.  Go ahead and select the first option, “Ubuntu” and continue to log in and admire your beautiful Ubuntu installation.  You can change the resolution by clicking on the Dash and selecting “Displays” to make things easier to read.

Insert your USB stick with your wifi drivers if you haven’t already done so and open a Terminal. Change to the directory of the USB stick and install each of the 3 dependencies first and then the wifi driver last.

cd /media/[USERNAME]/[USB DRIVE]
sudo dpkg -i  dkms*.deb
sudo dpkg -i libc6*.deb
sudo dpkg -i linux-lib*.deb
sudo dpkg -i bcmwl*.deb

You should now have wifi access.  Woohoo!

6. Repair EFI Boot Manager

I needed to do this so that I could load Ubuntu’s 64 bit EFI boot manager.  In the terminal, enter the following commands:

sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

When the popup appears, click on “Advanced options” and go to the “GRUB location” tab.  Check the box next to the option “Separate /boot/efi partition” and click on “Apply”.  You will be presented with a series of commands to enter into the Terminal.  Follow the instructions.  I ran into a dependency error on the last command I was presented with related to efi-amd64.  Go ahead and continue forward anyway and you will get the message that boot repair was successful.  Just for peace of mind, I ran the boot-repair command again but was not presented with the commands to enter and the final message indicated the repair was successful.  If someone understands this section better than I, please let me know.  After rebooting, you should now select the Ubuntu icon and not the penguin icon.

7. Fix Sound Setting

The last thing I had to fix was the sound setting.  Fortunately it was extremely easy.  Edit the file: /etc/modprobe.d/alsa-base.conf and add the following line to the bottom.

options snd-hda-intel model=mbp101

8. Additional Notes

At this point, you should be good to go. Everything else seems to be working well and it’s customizations from this point.  One important note, DO NOT INSTALL NVIDIA DRIVERS.  This will screw up your installation and you will not be able to boot back in.  Also, do not install laptop-mode-tools as that will also prevent you from logging back in.  In the event you do and you need to recover, boot from your USB startup drive and select “Try Ubuntu”.  Open a terminal and enter the following commands while replacing “/dev/sda4″ with your root partition. The “Disks” utility can help you find out what that is.

sudo mount /dev/sda4 /mnt
sudo chroot /mnt

You will now be able to do things as if you’re already logged in such as:

sudo apt-get purge laptop-mode-tools

Boot loaders

I don’t like seeing the Microsoft logo as an option.  I removed the Microsoft directory from /boot/efi/EFI.  You can move it somewhere else in case you want to put it back.

I like fast boot times.  If you log into the Mac OSX side and edit /boot/refind/refind.conf, you can reduce the timeout to a few seconds so that it will automatically load Ubuntu faster.  Also, on the GRUB side, you can edit /etc/default/grub and reduce the timeout value there as well.

I hope this helps someone save time instead of trying to figure it all out.  I’d definitely like to hear from anyone if this helps them and if there are any problems, please let me know!

9. References

http://randomtutor.blogspot.com/2013/02/installing-ubuntu-1304-on-retina.html

http://cberner.com/2013/03/01/installing-ubuntu-13-04-on-macbook-pro-retina/

http://commandline.org.uk/2013/03/08/lubuntu_on_macbook_pro_retina.html

19 Comments

  1. Hi,
    Thanks for sharing. I am planning to install Ubuntu on my 13″ retina MacBook Pro, too, and your post is very helpful and encouraging.
    I just wanted to know about your experience about the hires display: how are you dealing with it? Are you scaling objects, simulating the default setting on OSX, are you running at full resolution, or what?
    Moreover, how’s the battery life under Ubuntu? I read somewhere that it was not great with versions prior to 13.04…

    Thanks,

    Valerio

    • You can set the resolution in Ubuntu using the “Displays” application. I currently have it set to 1920×1200 to maintain the 16:10 ratio and I think it looks good but is still readable. If you want, you can go higher to 2560×1600 but I find that you’ll probably need a magnifying glass to read.

      The battery life is pretty decent. I find that the screen brightness has the largest effect on battery. I created a script to set the brightness on startup. The script is below:

      
      #!/usr/bin/env python
      
      import dbus
      bus = dbus.SessionBus()
      
      proxy = bus.get_object('org.gnome.SettingsDaemon',
                             '/org/gnome/SettingsDaemon/Power')
      
      iface=dbus.Interface(proxy,dbus_interface='org.gnome.SettingsDaemon.Power.Screen')
      iface.SetPercentage(30)
      

      I have an entry in the “Startup Applications” app to execute this and at full battery power, I can get 7 full hours of use.

  2. I installed Ubuntu using Refind as this tutorial explains, but I am having a problem. Everytime I close the notebook with Ubuntu running, it shuts down, it does not suspend as requested. Any suggestion?

    • I would check your settings in the “Power” section. I have mine set to “Do Nothing” when the lid is closed on battery power and when plugged in. If this is still a problem, I would also make sure you have the latest updates applied as well.

  3. Hi Alex,

    thanks a lot for you work and your information!
    I’m too working with ubuntu for years – I was tortured by Windows Vista too long and switched to ubuntu then. And I bought this 10,2 Macbook in December 2012. The display and its resolution is brilliant!
    I’m still running ubuntu since a few months as a vmware Fusion guest inside MacOS X. This is because formerly ubuntu (12.10) didn’t run really good out of the box (Touchpad, Wifi, Sound). Now ubuntu 13.04 runs well BUT I still couldn’t get used with the default way the touchpad is configured and I didn’t make it to change the gesture behavior.
    Can you give me some tipps?

    • Obviously Max OSX has better support for gestures and the touchpad in general but there are some things you can do to make it nicer on the Ubuntu side. If you go to Settings > Mouse & Touchpad, make sure to check the four checkboxes or whatever your preference is for using the touchpad. I’m accustomed to the 2 finger scroll and “Content sticks to fingers” settings. Also, I’d recommend installing a program to help.


      sudo apt-get install xserver-xorg-input-mtrack

      and then editing the file /etc/X11/xorg.conf.d/60-synaptics.conf by putting the following at the bottom of the file.


      Section "InputClass"
      Identifier "Disable clickpad buttons on Apple touchpads"
      MatchProduct "Apple|bcm5974"
      MatchDriver "synaptics"

      Option "FingerHigh" "50"
      Option "MinSpeed" "0.8"
      Option "MaxSpeed" "2.0"
      Option "SHMConfig" "on"
      # Option "PalmMinZ" "100"
      # Option "PalmDetect" "on"
      Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
      EndSection

      You will need to restart at least your window manager for this to take effect. I commented out the PalmDetect because I wasn’t sure if I liked it or not. If you really want real gestures, you will need to disable the built-in Unity gestures and follow the instructions here: http://task3.cc/1068/os-x-like-multitouch-gestures-for-macbook-pro-running-ubuntu-12-10/. I haven’t tried this so if you do, please let me know how it works for you.

  4. I’ve installed ubuntu 13.04 on my retina 13″ 10,2 and I get a black screen about 70% of boots. Would anyone know what to do about this? Strange, since it tends to be correlated to updates and 12.04 didn’t have this problem but doesn’t have sound either.

    Thanks,
    Phil

    • Hi Phil,

      Did you try adding the line in alsa-base.conf in section above? This fixed my sound issue. Also, I encountered a blank screen after installing the nvidia drivers from other tutorials. Since the 13″ MBP does not have an nvidia video driver, it will screw up the loading of your X-windows if you do install them. You could try booting from your Ubuntu startup USB drive, “Try Ubuntu”, mount the system, chroot into it, and use apt-get to remove the nvidia drivers. I hope it works for you.

  5. Pingback: Steps for Installing Mac OS X 10.8 Mountain Lion and Ubuntu 13.04 Raring Ringtail in Dualboot Configuration on MacBook Pro Retina 10,1 | Dynamic Subspace

  6. Did you run into an issue with “hotplugging” thunderbolt ports? From what I’ve read, at least earlier versions of Ubuntu had an issue with Macbooks that you had to boot the machine with your thunderbolt port peripherals attached, it wouldn’t detect them hot.

    • That’s a good question since I usually just use the HDMI out for external displays. I tried it out just now and it worked just fine hot detecting external displays. It didn’t work with a projector and I assume it’s probably because there was an issue with the projector drivers but monitors worked as expected.

  7. Awesome, thanks for the follow up! My last question would be one that seems newb, but it’s been a long week already – What are the recovery options? Will Apple’s recovery process reclaim the linux-partitioned space if I want to go back to all OSX?

    • Yes, I messed up the installation and reinstalled several times for this tutorial. I used Mac OSX’s disk utility to erase the Ubuntu partitions and resize the main partition to reclaim the space.

  8. I’m sorely tempted. Maybe I’ll try it out tomorrow. I’m afraid I’m already too used to OSX’s power-user gesture controls, but I miss some of the things I did without thinking in linux.

    Thanks for the tips, great writeup.

  9. Hi Alex,

    When I try to install the wifi drivers on my partitioned iMac Ubuntu drive I am getting the following error:

    dpkg: error processing dkms*.deb (–install):
    cannot access archive: No such file or directory
    Errors were encountered while processing:
    dkms*.deb

    Any ideas? Are different drivers required for the iMac than the MacBook pro?

    Many thanks.

  10. Hi all, I’m running 13.04, w/ gnome on macbook retina 10,2. Everyrhing works great, thunderbolt display with latest drm kernel and intel drivers is all very good.
    One thing I don’t have is ‘suspend’. It’s not even in gnome menu. However when thunderbolt display is unplugged, closing lid does suspend.
    Checked in system prefs/power and it is set to suspend on close… Anyone has same issue?
    Regards

  11. After almost six month, do you recommend this setup for development? I need to buy a new laptop and mac book pro are very attractive…

  12. Hi Alex. Great tutorial. I found it when searching for a fix for the lack of sound. I am using Mint Cinnamon 16. I got wifi working by a different route so that’s okay. But the edit in nano of the alsa-base.conf didn’t work. Perhpas this is because my MBP Retina is the late 2013 second edition, so maybe the model isn’t mbp101. Do you have any idea what it might be?

    Thanks,

    Michael

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>