Ubuntu 13.04 On The New MacBook Air (2013)

I rencently bought a new MacBook AIR with a 512GB SSD to have a Mac OS, Linux, Windows triple boot. There are lots of tutorial on how to install Ubuntu on a Mac.

Yet, the latest MacBook AIR brings some new hardware. The new Intel Haswell CPU is one of them: it brings both awesome performances and long lasting battery life. Up to 10 hours on Mac OS X! I was very eager to test Ubuntu to see how it would perform and since all Macs are now Intel based I did not expect too much problems. Yet it took me 2 days to get everything (I need) to work.

I encountered problems with:

  • The install process would simply not run.
  • The keyboard special/functions keys where not recognized and some keys are mixed.
  • The trackpad was detected as a mouse: no multitouch, not two-fingers scroll, no right click.
  • The Wi-Fi chip was not installed out of the box.
  • Sound doesn’t work.
  • After suspend, brightness is buggy and is either 0 (fully dimmed) or 1 (fully bright).

I wanted to share my experience (and also make sure I logged those steps somewhere) so here it is!

Installing Ubuntu

The first thing you must be careful about it the ISO disc image you download. You have to make sure it’s a Mac-compatible ISO. If you download the ISO from the official Ubuntu website from Mac OS, you’ll get a Mac-compatible ISO. Otherwise, make sure you download the right one from the Ubuntu Rairing Ringtail download page:

Ubuntu 13.04 (Raring Ringtail) downloads

Now you have the right ISO, you can setup a USB drive using unetbootin. When the drive is ready and plugged, reboot your MBA and make sure you press the Option (Alt) key as soon as it boots. You should then see multiple options and one of them will be named “EFI Boot” with a USB icon. Select this options and press Enter.

Proceed installing Ubuntu normally. Thanks to selecting the EFI Boot option, Ubuntu will install in EFI mode instead of the old-fashioned BIOS emulation mode.

Fixing Ubuntu’s Boot

When Ubuntu is installed, you’ll notice it takes some time to boot. A lot of udev error messages will also appear stating that it failed at locating the HDD or some partitions. To fix this we will add the libata.force=noncq option to our kernel. To do this, when you’re in Grub, just press ‘e’ to edit the command line and on the line starting with “linux” add the libata.force=noncq option at the end of the line.

Press F10 and Ubuntu should start a lot faster without any error message. To make this change permanent, edit the /etc/default/grub file and replace:

with:

Then run update-grub to update your Grub configuration. The kernel option will now be enabled by default and you’ll be able to start Ubuntu without any issue.

Installing the Wi-Fi drivers

Now Ubuntu is setup and booting properly, we will setup the Wi-Fi. To do this, we need to install some proprietary drivers available in the bcmwl-kernel-source package. You can try adding it with apt:

On my machine it does work and ends in a kernel panic. I searched for some time and finally found fixed debian packages:

Just make sure you install both packages at the same time running a command like:

Reboot and Wi-Fi should now work fine!

Fixing the touchpad and the keyboard

This is a bit trickier since we’ll have to re-compile our kernel. I was a bit scared of this since I never did it. Yet I was pleasantly surprised by how easy it is. Ubuntu’s documentation on Building Your Own Kernel is very well made and will teach you everything you need to know.

You just have to follow the article. The only difference is that we will actually patch our kernel before we compile it (the “Building the kernel” step). The patch is available here:

https://launchpadlibrarian.net/148354532/macbookair-3.11-rc6.patch

It’s meant for the 3.11 kernel but the destination files are exactly the same so it will work with Ubuntu’s 13.04 default kernel (3.8.29). To apply the patch, just go to the directory where the kernel sources have been downloaded and run:

The paths won’t match (since this patch was made for the 3.11 kernel). Patch will just prompt you to manully enter the actual path of the destination file. So “linux-3.11-rc6.orig/drivers/hid/hid-apple.c” should be rewritten into “drivers/hid/hid-apple.c” assuming you’re in the “linux-3.8.0” directory.
Using patch -p 1 will make sure the first dorectory is ignored and the patch applies without any problem.

Finish the kernel build/update process and voilà! Both the keyboard and the touchpad should work fine. You can even configure the touchpad in the “Mouse & Touchpad” menu. I also recommend isntalling “pommed” and “pommed-gtk” to have the function keys working nicely.

The only remaining issue is that the “@/#” and the “>/<" keys are mixed. To fix that, we will use xmod to remap those 2 keys:

Test the corresponding keys to make sure it works as expected and then run the following command to make the change permanent:

If you have problems or suggestions please hit the comments!

  • Pingback: Upgrading to Linux 3.11 on the new MacBook AIR 2013 | Jean-Marc Le Roux()

  • Pingback: Fixing 2013 MacBook Air Ubuntu sound issue | Jean-Marc Le Roux()

  • Thanks,
    I tried a couple a month ago to setup dual boot on my MacBook Air without any success. Following your description I managed to set it up. I had to add “nosmp” to the command line for Ubuntu to boot.

    Sven

  • Nice work! I come from using Debian, so I’m really interested in using Ubuntu on my MacBookAir6,2. I was wondering if you had to use to use rEFIt since almost all guides I’ve seen mention it. Also, do you suggest having an ethernet dongle handy or did you just transfer the wifi drivers from another computer using an usb? Thanks!

    • Promethe

      I used rEFInd, the more recent fork of rEFIt.

      To get the drivers on my laptop I shared my Android’s connection with an USB cable to download what I needed directly from the web. It worked out of the box.

  • heissam

    thanks a lot for sharing this.
    i am planning to buy a macbook air and install ubuntu on it as dual boot, so i was wondering if anything changed with ubuntu 13.10. i assume that ubuntu 13.10 comes with 3.11 kernel, so no need to install it manually. but does this has an effect on the wifi card, and the sound issue? what about the touchpad and keyboard?
    thanks

  • art

    Hello.

    I have some questions concerning the problem that can be encountered with installing 13.04 or 13.10 on mba 2013.

    I don’t know where to start because it’s quite complicated. (and my questions will be at the end)

    Also i hope the links will remain alive quite a long time.

    I had this problem when trying first boot after installing SS (saucy salamander):

    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1197451

    Comment #54 on the thread shows a patch that has been implemented in a new linux-image kernel
    available here (3.11.2):
    http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.11.2-saucy/

    Then i tried to install it and it still have the same pb.

    (notice that i manage to boot both image under vmware fusion)

    Then i think the real pb is not on the kernel but something related here (on comment 19):
    https://bugzilla.kernel.org/show_bug.cgi?id=60635

    I quote:

    “It’s a bug in the Compatibility Support Module that emulates a BIOS environment.
    EFI boot makes it see *all* CPUs and boot.”

    Now i have installed windows 8 x64 entreprise in EFI mode and notice that it creates itself a dedicated EFI boot partition.

    Then my questions are:

    – do i have to manually create a dedicated EFI linux boot partition with the one will have the OS?
    – will it be possible to do that without removing recovery partition, according to the fact that if we have 3 os that needs each a dedicated EFI boot partition, it would make 2*3 + 1 partitions?

    Hopes it will help other people.

    ps: they are some incompatibilities in current bootcamp drivers with mba 2013 which make keyboard and mouse are not responding.
    https://discussions.apple.com/thread/5102407

    • Promethe

      I had this problem when trying first boot after installing SS (saucy salamander):

      Make sure:
      1) you are using a Mac Ubuntu ISO: it seams there are two different ISOs and that downloading it from MacOS will give you the right one right away,
      2) you are booting on the CD/DVD/flash drive in EFI mode by pressing alt (option) when the MBA starts and choosing the proper drive to boot from.

      THE ISO I used are the official 13.04 ones. I encountered the bug you described at first; I’m not sure how I fixed it but I think the the two point mentioned above should be enough.

      – do i have to manually create a dedicated EFI linux boot partition with the one will have the OS?

      If I remember correctly you don’t need to do that because there already is a 200MB “EFI” labeled partition already used by MacOSX. To check that you can simply run gparted from a live CD. It’s at the beginning at the drive and I did not have to modify my MacOS partition so I’m guessing that EFI partition was there from the begining. It’s also consistent with the fact that MacOS boots using EFI so it needs that EFI partition.

      – will it be possible to do that without removing recovery partition, according to the fact that if we have 3 os that needs each a dedicated EFI boot partition, it would make 2*3 + 1 partitions?

      You need 1 single boot partition for all 3 OSs. The idea is that the BIOS will boot on the EFI partition, where rEFInd is installed. That will “boot” refind, that will in turn give you the choice of the OS you actually want to boot.

      Whenever you install an OS, you have to install it using EFI mode (remember: “alt” when the MBA starts) and it will eventually change you EFI boot to be the one OS that gets booted directly. I don’t know if it happened when I installed Ubuntu, but it definitely happen when you install Windows 8 (or when you update to Windows 8.1!!!). To fix that, boot from a live CD and install/run efibootmgr. Read the doc and it will tell you how to restore the boot order to make sure the EFI partition – and therefore rEFInd – boots first.

      have you installed the rEFind at first? i.e, before installing ubuntu?

      I don’t think it matters. Yet I would install it first: re-installing refind after a Windows install recently broke it. So I’d say you install rEFInd first and use the procedure above whenever one of the OSs “steals” the first place in the boot order (also happened with an update to Maverick I think, but not sure…).

      I might try to find the time to write all of this down in an actual article. But you now, CEO… stuff… :p

      • art

        Thanks for you complete reply sir.

        I think that yes i just simply mistaken on installing Ubuntu in EFI mode and pressing ALT at the boot.

        Shame on me.

        I have a 2012 mba and the process was easier I think.

        I will try again then this afternoon a triple boot with windows 8 EFI also.

        Bye

  • jeff

    Hello, thank you so much for writing this excellent guide. I also tried a few days to install ubuntu 13.10 on MBA 6.2 2013 version. However, still no luck to install it with EFI boot mode, it always getting into the old bios mode…:( I have tried to boot into bios via “cmd+opt+o+f” but failed again, any suggestion in this point?
    BTW, have you installed the rEFind at first? i.e, before installing ubuntu?

    Best Regards.

    • Chris

      Hey Jeff,

      I don’t think you can boot efi through a USB port on mac, you have to burn a cd and boot from and external cd Drive. Thats what I had to do anyway, seem to work fine once I did that.

  • Pingback: Fixing the MBA 2013/Ubuntu issue | Jean-Marc Le Roux()