Installing Ubuntu on a Macbook Air from a USB stick

I've been trying to install Ubuntu 10.04.1 (Lucid Lynx) on my first generation Macbook Air (MacBookAir1,1). Without a superdrive I needed to install the OS from a USB stick. It turned out to be a reasonably difficult thing to do so I though I'd document my steps here. The nice thing with this method is that it lets you run Ubuntu on your laptop first without having to install it and potentially damaging anything (try-before-you-buy).

Booting to Ubuntu

I mostly followed the steps outlined by user pxwpxw:

  • First I downloaded his bootusb.tar.gz files and extracted to my USB stick (> 2Gb, formatted as Fat32).
  • Next I downloaded the Ubuntu 32bit desktop edition (ubuntu-10.04.1-desktop-i386.iso). After validating the MD5 key (I'd been caught out before by a corrupted download), I copied the iso file to the root of my USB key.
  • Then I edited [usb]/efi/boot/grub.cfg and added the following menu entry:*
menuentry "Ubuntu 10.04.1" {
 fakebios
 search --set -f /ubuntu-10.04.1-desktop-i386.iso
 loopback loop /ubuntu-10.04.1-desktop-i386.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.04.1-desktop-i386.iso noefi
 initrd (loop)/casper/initrd.lz
}

(The key to getting this to work was to correct initrd.gz to initrd.lz from pxwpxw's original file config).

  • With the usb stick in my machine, I rebooted my Mac and held the option key down as it booted. This let me boot to the usb and select the new Ubuntu 10.04.1 menu option in the grub menu.
  • At this point I could boot to Ubuntu from the usb stick :)

* UPDATE - Thanks to Daniel Jenkins who pointed out that the above is a bit out of date. For Ubuntu 13.04 (and above) change casper/vmlinuz to casper/vmlinuz.efi in the editied [usb]/efi/boot/grub.cfg file.

[half way there...]

Installing Ubuntu

From here I could also start the installation procedure, however the standard partitioning program used in the installer (partman) wasn't willing to touch my Mac's HFS+ drive with a barge pole.

In theory, all I needed to do would be fire up Disk Utility in Snow Leopard and repartition my drive, however it turns out the space on HFS+ disks get very fragmented and DU needs plenty of contiguous free space to do it's thing (if it doesn't get this, it just pops up a rather unhelpful error message) 

I needed to find a way to partition my Mac. Rather then fork out for a piece of software, instead I followed these steps provided by closet geek.

  • Boot to Ubuntu on the USB stick, bring up a terminal window and type 'sudo gparted'. This is another partitioning program which happily let me repartition my Mac disk (note: following closet geek's suggestion, I disabled journal support on my Mac first - not sure if this was needed, but I did it anyway).
  • After a *long* while (~3 hours), gparted finished and I was able to then run the Ubuntu installer as normal :)
  • After Ubuntu had been installed successfully, I was nearly there. I then needed to install the boot loader rEFIt which lets you choose which OS you want to load at startup.
  • The last step was to overcome the black screen of death I got on when trying to boot Ubuntu from my grub loader. I'd got this issue before on another desktop Ubuntu installation - if I don't remove the quiet startup option, the machine fails to initialise properly and just hangs. Thankfully the fix is simple, in Ubuntu just run:

    sudo gedit /etc/default/grub

    and replace the line

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

    with

    GRUB_CMDLINE_LINUX_DEFAULT=""
  • After saving, run 'sudo update-grub' and all should be fine :)

Hardware setup

Out the box, I found a few hardware specific items that didn't quite work correctly.

  • To get my network card working I just followed the steps documented on the Ubuntu wiki page for my machine (also see the Ubuntu Wiki pages describing support for the other various MacBooks.)
  • To get the sound working, I followed the instructions outlined here and added the line 'options snd_hda_intel model=mbp3' to /etc/modprobe.d/alsa-base
  • The last hardware item that didn't quit work out the box was my trackpad. It stopped working whenever the machine resumed after been suspended. The solution to my problem was provided by Naresh. Basically I needed to add a file to /usr/lib/pm-utils/sleep.d/ which reinitialized my trackpad (modprobe bcm5974) whenever my machine resumed.

So finally, after many, many, many hours, I now have Ubuntu running side by side with my (still completely intact) Snow Leopard installation! People might say it shouldn't be this hard to install Ubuntu and I have to agree. On a desktop, my installations experiences with Ubuntu were a breeze. What I would say in Ubuntu's defense is that half my difficulties were due to the Mac boot mechanism and HFS+ file system. Still, I'm very happy with my new OS :)

Ubuntu on my mac