Results 1 to 10 of 24

Thread: Running Ubuntu 12.04 on a 2012 MacBook Air (5,2)

Threaded View

  1. #1
    Join Date
    Apr 2005
    Portland, OR
    Ubuntu 13.10 Saucy Salamander

    Running Ubuntu 12.04 on a 2012 MacBook Air (5,2)

    I recently obtained a 2012 13" MacBook Air (MBA) to use as a development laptop. The documentation on installing and running Linux on this year's model is fairly sparse and had to be collected and verified from numerous sources, so I'm summarizing it here in this post in the hopes it will be helpful to others. Follow these instructions at your own risk, and acknowledge that I accept no responsibility for possible damage that could happen to your computer due to following these instructions.

    I will try to edit and maintain this post as I learn new information or others correct me for any misundertandings (which I highly encourage you to do).

    I have absolutely no interest in OS X (and to be honest feel more than a tad hypocritical for buying an Apple product, but that's a rant for another time), so my goal was just to wipe the default OS and install a Linux distro (Ubuntu 12.04, "Precise Pangolin") natively. Before doing this, however, you may want to boot OS X just to mute the audio, otherwise you'll be stuck with the Apple "bong" sound when turning the machine on. This sound and its volume level are apparently encoded in the MacBook's firmware, and I'm not aware that it's possible to mute it without doing so from OS X.


    If you want to dual-boot your system with Linux and OS X, I have no experience with that, but I've heard that you may need to use an OS X utility called rEFIt to set up your partitions before booting your Linux installer - more details can be found in this Ubuntu Mactel Installation Guide.

    A number of people have reported problems trying to get the default Ubuntu 12.04 install CD or USB installation method to work. Thanks to this blog post, I learned that you can download an alternate Ubuntu 12.04 install ISO that is formatted differently to boot properly on UEFI-based Apple hardware. Additionally, this nightly image includes all of the package updates that have been released for 12.04, saving you time from having to download and install them. Download the precise-alternate-amd64+mac.iso file from here, and then simply dd it to a 1 GB or larger USB key. Of course you'll want to dd this to the full disk device name, e.g, /dev/sdb and not /dev/sdb1.

    Now plug that USB key into your MBA and hold down the Alt key while powering the computer on. Select the "Windows" disk to boot from and the Ubuntu alternate installer should come up. After selecting my language, I hit F6 and enabled the "noapic" boot option, which I've heard is necessary for stability. From there the install went smoothly - there was one warning about the broadcom wifi driver needing additional firmware, but that was safe for me to ignore, and on the first bootup the open source broadcom wifi driver seemed to work fine.

    Post Install

    At this point you should be able to boot into 12.04 (TODO: you still need to hold down the Alt key when powering the system on, I need to find out how to make it boot into Ubuntu automatically). You should be gentle with the system now, because the applesmc kernel driver that ships with 12.04 does not work properly with the 2012 hardware and your CPU fans will be locked at their lowest speed, 2k RPM.

    Most of the remaining information I gleaned from this excellent guide and post-install script which was written for the 2011 MBA.

    I'm copying portions of this script that I was able to run verbatim:

    # --- macfanctld
    # It is highly recommended to use the fan controller daemon that is included in
    # the mactel-support ppa called macfanctl. 
    echo "Adding macfanctld ppa (fan control daemon)."
    sudo add-apt-repository ppa:mactel-support/ppa
    # --- lightum
    echo "Adding lightum ppa (automatic light sensor daemon)."
    sudo add-apt-repository ppa:poliva/lightum-mba
    # --- broadcom-sta
    echo "Adding broadcom-sta ppa (better wireless module)."
    sudo add-apt-repository ppa:poliva/pof
    # --- fix 30seconds wifi timeout using wl driver
    sudo aptitude purge bcmwl-kernel-source
    echo "Installing packages."
    sudo aptitude update
    sudo aptitude install macfanctld lightum lightum-indicator lm-sensors broadcom-sta-dkms
    Critically Important Note: the mactel-support repo also has an updated applesmc kernel module that works with the 2012 MBA, so install that too and load the module:

    sudo aptitude install applesmc-dkms
    sudo modprobe applesmc
    Back to that script - you should be able to run these sections verbatim:

    # The program lmsensors detects the sensors, however it does not know what they
    # are yet. The module coretemp will allow lm-sensor to detect the others
    # sensors, the rotation speed of the fan, and the GPU temperature.
    sudo tee -a /etc/modules <<-EOF
    # make function keys behave normally and fn+ required for macro
    sudo tee -a /etc/modprobe.d/hid_apple.conf <<-EOF
    	options hid_apple fnmode=2
    sudo modprobe coretemp hid_apple
    # blacklist conflicting wireless module
    sudo tee -a /etc/modprobe.d/blacklist-bcma.conf <<-EOF
    	blacklist bcma
    # configure macfanctld
    tee <<-EOF
    	Configuring macfanctld to ignore some sensors. On my system three
    	sensors gave bogus readings, i.e.,
    	    TH0F: +249.2 C                                    
    	    TH0J: +249.0 C                                    
    	    TH0O: +249.0 C
    	Run 'sensors' to see current values; run 'macfanctld -f' to
    	obtain the list of sensors and their associated ID.
    	Applying this exclude: 13 14 15.
    sudo service macfanctld stop
    sudo cp /etc/macfanctl.conf /etc/macfanctl.conf.$(date +%Y-%m-%d)
    sudo sed -i "s/\(^exclude:\).*\$/\\1 13 14 15/" /etc/macfanctl.conf
    sudo service macfanctld start
    At this point I recommend rebooting and ensuring that the system comes back up with the coretemp, hid_apple, and (most importantly) applesmc kernel modules loaded (lsmod will show you your loaded kernel modules). Also make sure that macfanctld is running - while on some systems this daemon is optional, I believe it is mandatory for the 2012 MBA.

    I also will keep a terminal window open running watch sensors to keep an eye on the CPU temperatures and fan speed. The fan speed should start around 2k rpm and go up to 6.2k rpm when the CPUs heat up. If this doesn't happen, you could be damaging your system!

    Power Management

    By default, suspend to RAM works, but there are a number of tweaks you can make to reduce power consumption.

    Again, from the script:

    echo "Fixing post-hibernate hang."
    sudo tee -a /etc/pm/config.d/macbookair_fix <<-EOF
    	# The following brings back eth0 after suspend when using the apple usb-ethernet adapter.
    	SUSPEND_MODULES="asix usbnet"
    # no password after resume (like mac)
    echo "Disable lock screen after resume."
    gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'
    # --- Boot ------------------------------------------------------
    echo "Setting boot parm (better power usage)."
    sudo cp /etc/default/grub /etc/default/grub.$(date +%Y-%m-%d)
    SWAP=$(cat /etc/fstab |grep "# swap was on" |awk '{print $5}')
    sudo sed -i "s:\(GRUB_CMDLINE_LINUX_DEFAULT=\).*\$:\\1\"quiet splash i915.i915_enable_rc6=1 resume=${SWAP}\":" /etc/default/grub
    sudo update-grub
    echo "Ensuring bcm5974 loads before usbhid (editing /etc/rc.local)."
    # update /etc/rc.local to ensure bcm5974 is loaded BEFORE usbhid
    sudo cp /etc/rc.local /etc/rc.local.$(date +%Y-%m-%d)
    sudo sed -i '$i modprobe -r usbhid\nmodprobe -a bcm5974 usbhid' /etc/rc.local
    echo "Configuring extra power management options."
    wget -Nq || wget -Nq
    chmod 0755 99_macbookair
    sudo mv 99_macbookair /etc/pm/power.d/99_macbookair
    # disable bluetooth by default
    sudo sed -i '$i /usr/sbin/rfkill block bluetooth' /etc/rc.local
    Backlit Keyboard and Ambient Light Sensor

    lightum is a background program that controls your keyboard backlight and LCD screen brightness according to the ambient light sensor. It works just fine on my 2012 MBA:

    # --- enable lightum
    /usr/bin/lightum-indicator &
    gsettings set org.gnome.settings-daemon.plugins.power idle-dim-ac 'false'
    gsettings set org.gnome.settings-daemon.plugins.power idle-dim-battery 'false'
    For more lightum configuration options, check out the lightum README.


    The default settings the synaptic touchpad comes with in 12.04 were driving me nuts. I discovered I could even hover my finger a millimeter or so over the touchpad and make the mouse move, it was so overly sensitive. I owe a debt of gratitude to the author of this blog post for clearly describing the problematic default settings and how to change them.

    What Doesn't Work

    The Thunderbolt to Ethernet adaptor does not work, you'll want to pick up a USB to Ethernet adaptor instead.

    Other Notes

    The iSight camera works with cheese. I haven't tried it with Skype yet.

    I have not tested hibernate or using an external display yet, but I have heard they should work.

    I've tried running some of the Ubuntu 3.4 kernels, but haven't seen any noticable improvements from them, and sometimes they have introduced new problems. For example, with kernel 3.4.7, I found that the graphical login screen wouldn't come up after booting, so I'd have to go to a virtual console, login, and sudo service lightdm restart to get it to come up.


    Last edited by sgarman; August 9th, 2012 at 09:24 PM.
    Free Software - It's About Freedom


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts