How to Install (And Dual Boot) Ubuntu In Macbook Air (5,2)

I love Apple for their hardware, but when it comes to the desktop OS, I much prefer Linux (Ubuntu) over the OS X. I recently got myself a MacBook Air (the 2012 version, 5,2) and unsurprisingly, after using the Lion (and subsequently the Mountain Lion) as the default for two months, I have switched to using Ubuntu as the default OS. The installation process is not as easy as previous build of MBA. If you are keen to install and dual boot Ubuntu on your MacBook Air (5,2), here is the full tutorial.

If you have an external CD-ROM, it is easier to burn a Ubuntu LiveCD and boot from the CD. For me, I prefer to use the USB installer instead.

Note: The usual method of creating the USB installer using the Startup USB Creator tool in Ubuntu will not work in work. You have to follow the steps follow to get it to work.

1. In your Mac, download the 64-bit Mac (AMD64) desktop CD iso.

2. Once the download is completed, plug in your USB drive and open a Terminal (Applications -> Utilities -> Terminal).

3. Convert the iso file to img format with the following command:

hdiutil convert -format UDRW -o ~/path/to/ubuntu-12.04.1-desktop-amd64+mac.img ~/path/to/ubuntu-12.04.1-desktop-amd64+mac.iso

Replace the “/path/to” with the actual location of the iso file (you can drag and drop the iso file to the terminal to paste the file location).

4. Check the location of your USB drive:

diskutil list


5. Unmount the USB drive:

diskutil unmountDisk /dev/diskX

Replace “diskX” with the USB drive disk number.

6. Run the following command to create the USB Installer:

sudo dd if=/path/to/ubuntu-12.04.1-desktop-amd64+mac.img of=/dev/rdiskX bs=1m

Don’t forget to replace the “path/to” and the “rdiskX” with the file location and disk number respectively.

7. Lastly, eject your USB drive.

diskutil eject /dev/diskX

rEFit is a boot menu toolkit that can detect multi-boot system on Mac and allows you to boot into another OS easily.

1. Download the latest version of rEFit from here.

2. Install it in your Mac.

The next step is to partition your Mac to make space for Ubuntu. Open the Disk Utility (Applications -> Utilities -> Disk Utility)

1. On the left panel, select the Mac SSD. On the right, click the “Partition” tab.

2. Select “2 partitions” from the Partition Layout dropdown. You should see the partition layout become two equal containers.

3. Highlight the bottom container (the partition to use for installing Ubuntu). Give it a proper name and select “MS-DOS (FAT)” for the format. Next, change the hard disk size you want to allocate for Ubuntu.


4. Click Apply.

Once you have partitioned the hard disk, you are ready to install Ubuntu.

1. Plug in your Ubuntu USB Installer and reboot the Mac.

2. On the rEFit screen, press the right arrow to select the USB installer, and press and hold the “Ctrl” button while the USB installer is booting up. (Note: Failure to do this step will result in kernel panic)


3. On the Ubuntu boot option screen, first select English (or your preferred language) as the default language. Next, before you select any boot option, press F6. Scroll down the list to “noapic” and press “Enter” to select it (make sure there is a “X” beside the “noapic” option).


4. Press Esc, and select “Install Ubuntu”. This will skip the Ubuntu Live Desktop and boot directly to the Installer.

5. Follow the onscreen instructions to install Ubuntu until you reach the point where it asks you to select the “Installation Type”. Select the last option “Something Else”.


6. The partition table will now show up. You need to delete the FAT32 partition and create two other partitions – one for Swap and another for Ubuntu installation (ext4 format). The general rule of the thumb for the Swap size is to allocate twice the RAM size, up to a maximum of 4GB, so if you have 4GB or more RAM, make the Swap size 4GB. Leave the rest of the free space for Ubuntu.

Note: Some people will opt to create another partition for the GRUB installation. This is purely optional.





Make sure you select the correct partition for the boot loader installation.


Once you have completed this partitioning step, you can proceed to install Ubuntu.

After you have installed Ubuntu, remove the USB drive and reboot your Mac. On the rEFit boot screen, you should now see a new Penguin icon. select it.


1. When the Grub menu show up, quickly press “e” to edit the entry (we need to insert the “noapic” flag, else it will lead to kernel panic).

2. Scroll down to the entry that starts with “vmlinuz” and add “noapic” (without the quotation) at the end of the line, just before the closing quotation marks.

3. Press enter to boot into Ubuntu.

Note: If you are seeing a dark screen instead of the GRUB menu, you have to:

1. Boot to Mac OS X
2. Install the GPT fdisk terminal utility
3. Follow these instructions to build a hybrid boot menu.

If everything goes fine, you should be able to boot into Ubuntu now.

There are some fixes and tweaks that we have to perform before Ubuntu can function properly.

Open a terminal and type:

chmod a+x

It will issue a warning that the script is not meant for your version of Mac. You can ignore it and continue the installation process. The script It will add a few PPAs and install a few important fixes, including macfanctld (CPU fan control), lightum (light sensor), broadcom-sta (wireless card driver), xmodmap (key mapping), suspend, etc.

Next, install the updated applesmc kernel module that works with the 2012 MBA.

sudo apt-get install applesmc-dkms
sudo modprobe applesmc

Lastly, we need to add the “noapic” flag to GRUB so the OS can be booted correctly the next time round.

sudo nano /etc/default/grub

In the file that loads up, scroll down to find the line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=1 resume=/dev/sdaX"

Add “noapic” to the end of the line, just before the closing quotation mark. It should become like this.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=1 resume=/dev/sdaX noapic"

Save (Ctrl + o) and exit (Ctrl + x) the file. Update the Grub.

sudo update-grub

That’s it. You should be able dual boot Ubuntu on your Mac now.

Most of the stuff should work fine in Ubuntu, but I have come across a few things that are not working well in Ubuntu.

1. Screen Lock

I have not been able to lock the screen through the gnome-screensaver or keyboard shortcut. The only way is to remove the “gnome-screensaver” and install “xscreensaver” instead.

sudo apt-get autoremove gnome-screensaver
sudo apt-get install xscreensaver

2. Touchpad

The Mac touchpad doesn’t work as well as in OS X. You can install TouchEgg (compile and install from the source for the latest version) and/or follow these instructions to make the touchpad easier and better to use.

Update: I have updated to Ubuntu 12.10 without any issue. There is no need to set the “noapic” flag during boot up and the WiFi module works great.
I will keep this list updated. Check back for more details. If you come across things that don’t work and its fixes, do let us know in the comments too. For more detail, check out this post: How to Install Ubuntu 12.10 In Macbook Air