Why Ubunty on MacBookPro Retina?

Because Linux/Ubuntu is greatest Software, and MacBookPro Retina is greatest Hardware!


I have happily run Ubuntu on my previous MacBookPro (non Retina). When I changed job in September 2012, my new employer provided me with a brand new MacBookPro Retina model on which I tried to install Ubuntu, to finally fail (crappy wifi, resolution not tunable...). At that time, there were (and there still are people) trying to achieve and document the process. Just google for it, you find many partial attempts this last year as same outdated documentation. Fortunately, Ubuntu code has pretty evolved well and it is much easier nowadays to have a working MacBookPro/Retina/Ubuntu combination...

When I finally bought my own Retina, I gave it another try, this time a successfull one!

I just wanted here to dump here my experience on this. Hope it will be useful to someone... The proof of my success is the screenshot and the photo hereafter.



So here we go...

Get a MacBookPro Retina Hardware

Hope you know the place for it, who doesn't know? I personally took the most memory and disk available.

I am happy to have done so, as my needs are constantly rising. But it's all up to you, depending on the budget you have and are willing to invest.

Say "bye bye"" to Mac OSX

OSX is great, Ubuntu is greater, otherwise don't bother reading this page... really...

Install Ubuntu 13.04 from USB Stick

Because the MacBookPro Retina has no CD/DVD reader, you will install Ubuntu from a USB stick.

The official documentation and howto is on the Ubuntu web site (AppleIntelInstallation).

Since the time I installed downloaded the CD image to write on my USB stick, it seems that Ubuntu has package differently its distribution, and I don't find back the exact CD image I downloaded.

At the time being, I would give a try to the ubuntu-13.04-desktop-armhf+omap4.img file. I hope it will work for you...

The first steps to create the USB stick are not so friendly, but be motivated and continue.

When the USB is ready, boot your Retina from USB (press ALT key when booting). From there on, there will be a few questions to answer during the setup, but it should be rather straighforward and should work fine. At the end, you will be asked to reboot your laptop. If after rebooting it does not restart, try a hard power-off/power-on. If the setup process fails, try again, and again... It is usually easier after the second try as you get used to the process...

Fix It!

Unfortunately, there are a few bits to fix here:

  1. The wifi is not working, which is quite embarassing as there is no wired ethernet on the Retina...
  2. The touchpad is overreacting to your movements...
  3. The sleep mode is making your laptop unresponsive...

...fortunately, you will know how to fix these issues reading the next sections.

Wifi

I found ubuntu-1304-daily-build-macbook-pro.html blog post. It basically tells you to install a few deb packages to make you wifi work. As you don't have any wifi, download those packages from http://packages.ubuntu.com on another connected station, copy the deb files to a USB stick, transfer these to your Retina and run from a terminal the magic command "dpkg -i *.deb"

  eric@eric:~/deb$ ll
  total 5312
  drwxrwxr-x 2 eric eric    4096 Sep 28 10:36 ./
  drwx------ 4 eric eric    4096 Sep 30 07:21 ../
  -rw-r--r-- 1 eric eric 1345530 Jul 27 13:46 bcmwl-kernel-source_6.20.155.1+bdcom-0ubuntu6_amd64.deb
  -rw-r--r-- 1 eric eric   72802 Jul 27 13:47 dkms_2.2.0.3-1.1ubuntu2_all.deb
  -rw-r--r-- 1 eric eric 3088016 Jul 27 13:47 libc6-dev_2.17-0ubuntu5_amd64.deb
  -rw-r--r-- 1 eric eric  918106 Jul 27 13:47 linux-libc-dev_3.8.0-19.29_amd64.deb
  eric@eric:~/deb$ sudo dpkg -i *.deb
  [sudo] password for eric: 
  eric@eric:~/deb$ ...

Tip: When the wifi is working, run a "sudo apt-get update" to update your package list. You will need it just after to change your screen driver.

Touchpad

I quickly came to an issue regarding the touchpad. It was too way sensitive and the available configuration in the settings panel were useless. This issue is documented on the Ubuntu issue tracker and some solutions are proposed around.

On my laptop, I created the script hereafter wich is invoked on each session opening (simply call the script in your ~/.bash_profile).

#!/bin/bash

# The first parameter controls release pressure, the third is to detect a button press???.
# 100 190 255
# >>> 50 90 255
# 12 35 255

xinput set-prop "bcm5974" "Synaptics Finger" 50 90 255

PS: I didn't find the perfect settings, this means that I still sometimes have heratic touchpad behavior. With the time, my fingers got used to it...

Sleep Mode

I often move around with my laptop. This means that I leave my applications opened and simply close the lid. With the default settings, the system could simply not recover (reopening the lid was giving a blank screen with a blinking cursor at the best).

This issue is also reported around. What is not reported is the solution... I was finally happy to find a solution for this which is "favor the NVIDIA instead of Nouveau".

This means, go to the "Settings" panel.

Select "Software and Updates" (if you have run "sudo apt-get update", NVIDIA should be listed). NVIDIA (nvidia-313-updates) selection works for me.

Screen Resolution

The downside with the NVIDIA driver is that you it does not allow you to choose the screen resolution (the Nouveau driver allows it, but fails on sleep...).

I am a big fan of low resolutions, but in the Retina case, the fixed resolution (2800x1800) is far to high, making text reading... unconfortable.

To change the resolution with a shell script, I found this gist.

#!/bin/bash
#Author: Travis Gibson
#This script requires an argument for the resolution width
if [ -z "$1" ]; then
echo "Usage: Res.sh resolution_width";
exit 1;
fi
erg=$( echo "$1")
check=$(xrandr -q | grep DP-2 | cut -d " " -f 3 | cut -d "x" -f 1)
if [ "$erg" -eq "$check" ]; then
echo "The screen is already at this resolution"
exit 1;
fi
 
resolution=$(xrandr -q | grep DP-2 | cut -d " " -f 3);
 
if [ "$resolution" != "2880x1800+0+0" ]; then
xrandr --output DP-2 --scale 1x1;
#Necessary to work around an issue where re-scaling
#only works if the scale is set to 1x1
sleep 3;
fi
scale_w=$(echo "scale=4; $1/2880" | bc; exit );
arg=$(echo "$scale_w""x""$scale_w")
xrandr --output DP-2 --scale $arg
sleep 1;

Once again, I created a script "set-screen-resolution.sh" and called it on session opening from my ~/.bash_profile. The script is clever enough to detect if you are already in the requested resolution, so it will not do unuseful work.

Enjoy, Amaze your-self and your Friends

Yes, you will feel odd and amazing. Just apt-get any software you like, compile great software and run awesome servers.

And when someone asks you what are the unusual windows they see on your Mac, just say "it is Ubuntu"....

Now running on trusty

For information, I reinstalled recently with a Ubuntu trusty daily snapshot, followed the described procedure, and it worked great.

For trusty, you will need other deb versions:
bcmwl-kernel-source_6.30.223.141+bdcom-0ubuntu2
amd64.deb, dkms_2.2.0.3-1.1ubuntu4_all.deb
libc6-dev_2.17-93ubuntu4_amd64.deb
linux-libc-dev_3.12.0-4.12_amd64.deb.

You will also need to update the above set-screen-resolution.sh script, replacing line 9 with

check=$(xrandr -q | grep DP-2 | cut -d " " -f 4 | cut -d "x" -f 1)

I also running with a higher resolution than mentionned above. I use now 'aos-screen-resolution.sh 2200' which gives me 2200 pixels width.

<< Home Page