The MacBookAir4,2 works well with Ubuntu 11.10 Oneiric Ocelot, but does need some post installation configuration. Earlier versions of Ubuntu work less well and are likely to need significant, expert setup. At present, configuring an Ubuntu installation on the MacBookAir is likely to prove difficult for someone with no prior experience of using Linux. Novices users might be better to use VirtualBox to install Ubuntu in a virtual machine.
For further discusion and to seek help, see Ubuntu MacBookAir 4 thread in the Ubuntu Forums.
MacBookAir 4,2 and Ubuntu 11.10
This page aims to describe the steps needed to fully enable all features of the 13 inch 4th Generation MacBookAir (release date: July 2011) when using Ubuntu 11.10 (Oneiric Ocelot). The same instructions also work with the 11 inch 4th Generation MacBookAir (release date: July 2011). If you have a different model, please go here and find the right wiki.
Overview
Anything not mentioned here should work out of the box. If not, please refer to the Ubuntu Apple Users forum.
Feature |
Support status |
(works out-of-the-box)
(works, with remarks)
(needs manual install)
(won't currently work (completely))
(not yet documented)
Basic Installation Instructions
General instructions for installing and maintaining Ubuntu on Intel-based Macs are found in the Intel CPU-based Macintosh Generic Installation Instructions. Note that a few differences exist for this particular model:
You should use Ubuntu 11.10 64-bit: ubuntu-11.10-desktop-amd64+mac.iso
The MacBookAir4,2 is preinstalled with OS X Lion, and it is impossible to use the Lion version of Bootcamp to create space for installing Ubuntu. Follow the alternate instructions using DiskUtility instead:
Install refit, then reboot to OS X again
Start Disk Utility (in the Utilities folder inside the main Applications folder) and repartition OS X to your liking, set the remaining to msdos (fat).
The MacBookAir4,2 has no CD/DVD drive, and cannot start Ubuntu from a USB stick created using the standard tools. However, a script is available that will create a suitable USB image - do not believe the opinion widely expressed on other websites that it is necessary to purchase an Apple Superdrive. Note that: lines 21 and 22 of the script need to be edited in accordance with the adjacent comments; the script must be run from within Ubuntu and will not work under OS X, so you'll need another PC with Ubuntu (possibly running from a Live CD or Live USB image) to complete the task; and the script will not work on Ubuntu 10.04 Lucid Lynx. Once the script has been edited, it must be made executable and executed with root privileges:
cd [path to script] chmod a+x setup_mac_usb_boot.sh sudo ./setup_mac_usb_boot.sh
- When booting from the USB stick, it is necessary to edit the boot parameters to achieve a usable graphical login: press F6 at the initial menu and add 'nomodeset' before the final '--'. If you're comfortable with the command line, this step isn't necessary - simply press ctrl-alt-F1 to gain a login prompt.
During the Ubuntu installation choose "other configuration" to load gparted and repartition the empty space (msdos partition we have created before using DiskUtility). It is Important to set boot drive to the "/" partition (for me this was sda4).
- Once installation finishes, reboot and select resync from refit and hit 'y', then power down from refit.
- The first time you start using the newly installed Ubuntu system, it is similarly necessary to add 'nomodeset' to the boot parameters - at the intial Grub menu, press 'e' to switch to edit mode and, when you've finished, press ctrl-X to load Ubuntu. This step will normally have to be repeated after any kernel updates.
Some (but not all) users have reported post-installation problems with the Master Boot Record (MBR). If you get "No Operating System Found" or a black screen after choosing Linux from the rEFIt menu (and you tried rEFIt's resync), you'll need to install GPT fdisk (aka gdisk) (you can do this from MacOS or from the live session). Once you have gdisk follow these steps.
After installing, download the post-install-oneiric.sh script. To run the script, it's necessary to first make it executable, and then to execute it as root:
cd [path to folder containing script] chmod a+x post-install-oneiric.sh sudo ./post-install-oneiric.sh
The script will download, compile and install various drivers and update other configuration settings needed to allow the MacBookAir4,2 to function fully under Ubuntu. Particular credit should be given to Joshua Dillon who is almost entirely responsible for its development.
After running the script, restart your computer. It will be necessary to run the script again whenever a kernel update is applied - you'll know this has happened because it will be impossible to reach the normal login screen without adding 'nomodeset' as described above.
Further instructions
This page is a work in progress, and outlines the steps that a reasonably knowledgeable user would use to install Ubuntu on a MacBookAir4,2. If you encounter difficulties, you can find further information and ask questions in the Ubuntu MacbookAir4 Thread.
The relevant code snippets from post-install-oneiric.sh script are embedded into this wiki page on a per-task basis, so you can copy and paste one snippet at a time, so you know exactly what changes are being made. Just running the script --although convenient-- is potentially too much of a black box for many users.
LCD Panel
Does not work out of the box without using 'nomodeset' (see above) and then only at the wrong resolution. Works perfectly after running the post-install-oneiric.sh script - see above.
wget -Nq http://www.almostsure.com/mba42/fix-i915.sh bash fix-i915.sh
Suspend, Hibernate, Shut-down and Reboot
All except hibernate work perfectly with no need for post-installation changes.
To fix the hibernate problem, you need to add the resume parameter with the correct swap partition to the kernel boot options. For example, in my case, swap is at /dev/sda5 so I edited /etc/default/grub as follows:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=1 resume=/dev/sda5"
after making this change, run 'sudo update-grub'.
The following change brings back eth0 after suspend when using the apple usb-ethernet adapter:
echo 'SUSPEND_MODULES="asix usbnet"' | sudo tee -a /etc/pm/config.d/ethernet_fix
Keyboard functions (Brightness,volume,...)
The keyboard backlight keys don't work properly, and the media keys are incorrectly mapped by default. Everything works well after patching the hid-apple kernel module, after running the post-install-oneiric.sh script - see above.
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r) apt-get source linux-image-$(uname -r) wget -Nq http://www.almostsure.com/mba42/hid-apple.patch cd linux-$(uname -r|cut -d- -f1)/drivers/hid patch -p2 <../../../hid-apple.patch make -C /lib/modules/$(uname -r)/build M=$(pwd) hid-apple.ko sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install # the following command may be necessary: sudo cp /lib/modules/$(uname -r)/extra/hid-apple.ko \ /lib/modules/$(uname -r)/kernel/drivers/hid/hid-apple.ko
In some UK keyboards, mappings aren't correct (±§~` symbols). With care, all these issues can be fixed using the xmodmap program:
xmodmap ~/.Xmodmap
example xmodmap configs: 1. dfacto 2. pof
Keyboard backlight
Reported as working out of the box for most users. Others find that the backlight may be switched on as required with the 'keybacklight' command after running the post-install-oneiric.sh script - see above.
If you want to enable automatic keyboard brightness level, based on the ambient light sensor (just as OS X does), you can install lightum:
sudo add-apt-repository ppa:poliva/lightum-mba sudo apt-get update sudo apt-get install lightum
Touchpad
Works perfectly out of the box on the MBA 13" model since the kernel patch is already in. The MBA 11" still needs a small kernel module patch to work.
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r) apt-get source linux-image-$(uname -r) wget -Nq http://www.almostsure.com/mba42/bcm5974.patch cd linux-$(uname -r|cut -d- -f1)/drivers/input/mouse patch -p3 <../../../../bcm5974.patch make -C /lib/modules/$(uname -r)/build M=$(pwd) bcm5974.ko sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install # the following command may be necessary: sudo cp /lib/modules/$(uname -r)/extra/bcm5974.ko \ /lib/modules/$(uname -r)/kernel/drivers/input/mouse/bcm5974.ko # update /etc/rc.local to ensure bcm5974 is loaded BEFORE usbhid sudo sed -i '$i modprobe -r usbhid\nmodprobe -a bcm5974 usbhid' /etc/rc.local
There are different drivers available for the touchpad:
xf86-input-mtrack (used by default in post-install-oneiric script): Highly configurable trackpad driver with all features enabled, see xf86-input-mtrack page on github for configuration details.
Note that it is also convenient to install dispad, a small daemon for temporarily disabling the trackpad while typing on the keyboard. Dispad is also installed by post-install-oneiric script by default. Configuration file is on '~/.dispad'.
synaptics (used by default when there is no xorg config file): Use the 'Mouse and Touchpad' option in system settings to enable multi-touch scrolling and tap-to-click. Note also that a 3-finger tap allows easy window movement, and a 4-finger swipe reveals the Unity menu.
touchegg (not used by default): you can install it just by 'apt-get install touchegg', it works best together with the synaptics xorg driver, although it can work with 'evdev' too. Unfortunately it doesn't work with mtrack. For the advanced gestures to work you need to launch the 'touchegg' daemon. Configuration file is on '~/.config/touchegg/touchegg.conf'.
Wireless
Works perfectly out of the box.
Bluetooth
Works perfectly after upgrading from Linux 3.0.0-12 to 3.0.0-14, as the following patch have been included.
Previous to Linux kernel version 3.0.0-14, Bluetooth can be made to work perfectly by running the post-install-oneiric script, as it patches the btusb module:
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r) apt-get source linux-image-$(uname -r) wget -Nq http://www.almostsure.com/mba42/btusb.patch cd linux-$(uname -r|cut -d- -f1)/drivers/bluetooth patch -p2 <../../../btusb.patch make -C /lib/modules/$(uname -r)/build M=$(pwd) btusb.ko sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install # the following command may be necessary: sudo cp /lib/modules/$(uname -r)/extra/btusb.ko \ /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko
iSight
Works perfectly out of the box.
Sound
Works perfectly out of the box, but it's switched off by default after installation. Run "sudo alsamixer" command in a terminal. Then select the surround channel and unmute it by pressing "m" and put the volume up.
Microphone
Works perfectly out of the box.
External Monitor
Works perfectly out of the box. Some users have reported problems getting the external monitor to work after resume from a suspend, specially when using compiz (unity 3d). As a workaround, switch to the unity2d interface.
Thunderbolt
Thunderbolt support is not yet available under Linux. This is an area under heavy development and support is likely to be available in future versions of Ubuntu.
SD card slot
Works perfectly out of the box.
Fan Control
Works perfectly out of the box, macfanctld isn't strictly needed but if you want to install it:
wget -Nq https://launchpad.net/~mactel-support/+archive/ppa/+files/macfanctld_0.6~mactel1_amd64.deb sudo dpkg -i macfanctld_*.deb sudo service macfanctld stop sudo sed -i "s/\(^exclude:\).*\$/\\1 13 14 15/" /etc/macfanctl.conf sudo service macfanctld start
HFS+ (OS X disc partition)
Works perfectly out of the box.
Sensors (temps & fans)
Works by default however to (optionally) read the sensor data requires the package lm-sensors which is installed by post-install-oneiric.sh.
sudo aptitude install lm-sensors sudo tee -a /etc/modules <<-EOF coretemp hid_apple EOF
GPU Power Save
The post-install script, post-install-oneiric.sh, adds a boot parameter to grub, which allows the GPU to enter a low power state when it is idle. This option offers a considerable power reduction of 26%, according to an article at Phoronix.
sudo cp /etc/default/grub /etc/default/grub.$(date +%Y-%M-%d) sudo sed -i "s/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*\$/\\1\"quiet splash i915.i915_enable_rc6=1\"/" /etc/default/grub sudo update-grub
Other Power Saving tips
To automatically lower screen brightness and enable power management for USB/PCI/SATA devices when on battery:
wget http://pof.eslack.org/archives/files/99_macbookair sudo mv 99_macbookair /etc/pm/power.d/99_macbookair sudo chmod 755 /etc/pm/power.d/99_macbookair
If you don't use bluetooth regularly you can disable it by default at boot time. You can enable it manually later by clicking on the top panel bluetooth icon if you need to use bluetooth:
sudo sed -i '$i /usr/sbin/rfkill block bluetooth' /etc/rc.local