On installing Ubuntu 12.04 or 12.10 on a Macbook Pro Retina

Useful things to know beforehand

Ubuntu 12.04 is also known as precise
The soft reboot keys on a Macbook are fn+ctrl+alt+backslash
The command to switch the tty console is fn+ctrl+alt+F1 , ... , fn+ctrl+alt+F7
The pipe symbol | is (right-alt)+<
The tilde symbol ~ is (right-alt)+(+), space
At least this holds true on my German keyboard

Getting started via USB-Stick install, rEFIt, etc.

There are excellent resources on the web for the first steps. I used this one: CBerner.
Thus, from now on, I assume that we have rEFIt or rEFInd as the primary boot loader from which we can select linux to get into grub and boot a working installation of Ubuntu 12.04 with internet access (even at the tty console level).

Getting the native resolution to work and UEFI booting

The main purpose of this article is to summarize the steps that I took to get the native resolution of 2880x1800 to work in ubuntu.
Even though I could manage to get this resolution on the text level at some point, I couldn't manage to have it in X without using EFI. So the next step is to get grub-efi working. For this, I recommend the steps 21-28 in Rodbooks's UEFI
Don't reboot yet. We first need to modify grub.cfg and xorg.conf
Nevermind that Rodbook uses rEFInd rather than rEFIt.
You need to modify your grub.cfg somewhat now:
sudo gedit /boot/grub/grub.cfg
Use the boot flags nomodeset nointremap
Use debug=video
Use insmod efi_gop
More details on these and further commands can be found here: ubuntu.com/UEFIBooting
The following minimal grub.conf does the job for me:
set debug=video
insmod efi_gop
insmod font

if loadfont /usr/share/grub/unicode.pf2 ; then
  insmod gfxterm
  set gfxmode=auto
  set gfxpayload=keep
  terminal_output gfxterm

menuentry 'Ubuntu, mit Linux 3.2.0-29-generic (nomodeset, nointremap)' 
  --class ubuntu --class gnu-linux --class gnu --class os {
	insmod gzio
	insmod part_gpt
	insmod ext2
        set root='(hd0,gpt5)'
	search --no-floppy --fs-uuid --set=root 2b02a228-5b9c-4f94-8109-02f4cd87381b
	linux	/boot/vmlinuz-3.2.0-29-generic 
	  root=UUID=2b02a228-5b9c-4f94-8109-02f4cd87381b ro   quiet splash noapic 
	  $vt_handoff nomodeset nointremap
	initrd	/boot/initrd.img-3.2.0-29-generic

Note however, that you need to use your own UUID instead of 2b02a228-5b9c-4f94-8109-02f4cd87381b.

With no xorg.conf in place, lightdm would try vbe, vesa, etc. and not succeed setting up X. A driver that works is fbdev, so I use the following /etc/X11/xorg.conf contents
Section "Device"
	Identifier	"Configured Video Device"
	Driver		"fbdev"

Section "Screen"
	Identifier	"Default Screen"
	Device		"Configured Video Device"

Note that the old linux link (penguin) in rEFIt won't work anymore after this setup. Instead you should use the new one (this had 3 colored boxes as a logo in my rEFIt).
On the way, I had plymouth connection failure and applesmc errors which I ignored.
With this setup, ubuntu should start into the full resolution desktop.

If you see a blinking cursor beftween grub and the greeter and prefer the splash screen, this helped me to see a bit more of the splash: sudo gedit /etc/initramfs-tools/conf.d/splash
Enter this in the file:
Then save the file and do sudo update-initramfs -u
For more info on this, please consult askubuntu

Nvidia driver

The Macbook Pro Retina has two graphic adapters, we configured the system to use the Intel above by using fbdev. There is also an nvidia driver used for 3d graphics applications. In order to use the nvidia driver it is essential to add the line
Option "UseDPLib" "off"
to the Device Section in /etc/X11/xorg.conf, so this file might looks like this:
Section "Device"
	Identifier	"Configured Video Device"
	Driver		"nvidia"
	Option		"UseDPLib"	"off"

Section "Screen"
	Identifier	"Default Screen"
	Device		"Configured Video Device"
	DefaultDepth	24

Section "Module"
	Load	"glx"
You also have to install a package that gives you an nvidia driver. Not all of them seem to be working well and you might have a black screen instead of the greeter with some of them. One constellation that does work is kernel 3.7.0-7 in ubuntu 12.10 with the driver from the package nvidia-current-updates of version 304.88. You might have to install some ppas to have this, I executed
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
To switch between the Intel and Nvidia driver you may change "nvidia" to "fbdev" and vice versa in xorg.conf and reboot. This being quite inconvenient, a better option would be to use vga_switcheroo.

Setting up a thunderbolt ethernet adapter

Note that this device is an adapter that you need to purchase and put in a thunderbolt port to be able to plug in an ethernet cable. Assuming you have done this, you need to set up your /etc/network/interfaces file to contain an ethernet configuration. Mine is static, so I use
auto lo
iface lo inet loopback
auto eth0
iface eth0 static
If yours is dynamic, use
auto lo
iface lo inet loopback
auto eth0
iface eth0 dhcp
You might additionally need to set this up in the ubuntu network manager (I had to) which works after the next step: We need compile a patched version of the tg3 driver. However this is easy. Go to www.broadcom.com and download the tg3 driver for linux: Goto Desktop/Mobile and scroll down for the Linux driver. The direct link is this tg3 driver from Broadcom.com. You can basically follow the instructions on the Broadcom website for installing this driver (unzip, ... make install) with one important twist however: Before you compile, you need to add a line to the file tg3.c. Open this file and look for
and replace this part by
After this, do the obligatory sudo make install and remove or rename the old tg3.ko driver (use locate to find it). You can plug in your adapter and ethernet cable and upon restart, the driver tg3 will get loaded automatically and ifconfig shows an eth0 device which is ready for use. I got this hint from here.

Small things to improve life

Third mouse button

Execute the following to have three finger tap as the third mouse button
echo synclient TapButton3=2 > ~/touchpad_settings.sh
chmod +x ~/touchpad_settings.sh
gsettings set org.gnome.settings-daemon.peripherals.input-devices hotplug-command "/home/user/touchpad_settings.sh"
where user is your own user. I got this from here.

Window borders

If you feel resizing windows is hard with the thin borders, you should do locate metacity-theme-1.xml, cd to the directory of your theme, e.g. cd /usr/share/themes/Ambiance and then sudo gedit metacity-theme-1.xml. In the section frame_geometry name="normal" change the values of the fields left_width, right_width, bottom_width, e.g. use
<distance name="left_width" value="6"/>
<distance name="right_width" value="6"/>
<distance name="bottom_width" value="6"/>
This becomes effective after restart (source for me was this).

Useful links