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!
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:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash libata.force=noncq"
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:
apt-get install bcmwl-kernel-source
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:
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:
patch -p 1 < macbookair-3.11-rc6.patch
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:
xmodmap -e "keycode 49 shift = less greater"
xmodmap -e "keycode 94 shift = at numbersign"
Test the corresponding keys to make sure it works as expected and then run the following command to make the change permanent:
xmodmap -pke > ~/.Xmodmap
If you have problems or suggestions please hit the comments!