Fixing 2013 MacBook Air Ubuntu sound issue

Regarding my Ubuntu adventures for the latest MacBook Air 2013, I already posted about how to:

If you follow those two blog posts, you should end up with a very functional Ubuntu install and the linux 3.11-rc7 kernel working on your MacBook Air 2013. As we’ve already taken care of the Wi-Fi, the touchpad and the keyboard, two issues remain:

  • Brightness settings do not work as expected after suspend.
  • Sound does not work in the speakers (it works fine in the headset though)

In this post, we will see how to fix the second issue. And in order to make the speakers work we will have to patch the kernel and re-compile (yes, again!). Luckily, I have already explained everything you need to know so you’ll just have to follow the same procedure except you have to apply this patch before you re-compile.

When the new kernel is built, install it as usual and don’t forget to re-install the Wi-Fi driver module. Reboot and sound should now work fine!

Now sound is fixed, the brightness issue seams to be the last problem… please let me know if you find anything!

Upgrading to Linux 3.11 on the new MacBook AIR 2013

In my last post I explained how I installed Ubuntu on the new MacBook AIR 2013. The last issues I have are:

  • Sound doesn’t work.
  • Screen brightness is either 0 (total dark) or 1 (totally lit) after coming back from suspend.

I thought both issues might be kernel related. I also read that actual support for Haswell processors was coming in the 3.11 Linux Kernel so I wanted to give it a try. That’s why I started working on compiling the 3.11-rc7 kernel for Ubuntu.

Building the kernel

Building the kernel is really easy. I fetched the sources from the Ubuntu “saucy” repository with the following command:

Before actually building the Kernel, don’t forget the apply the patch to add support for the new mouse/keyboard! Then I just copied my current kernel configuration:

I updated the configuration with the new kernel options:

and I finally build the kernel:

  • The “-j” option will make sure the build process will use as many CPUs as possible
  • “LOCALVERSION=-custom” is used to name your kernel packages with the “-custom” suffix (instead of “-generic”)
  • “INSTALL_MOD_STRIP=1” is used to remove debug symbols and make the final binaries significantly (10 times!) lighter

When the build is finished, just install the packages (they are created in the parent directory):

Fixing the Wi-Fi

The Wi-Fi uses a proprietary Broadcom driver that will need to be re-compile against this new kernel. Compiling the driver module yourself is a nightmare. Instead, you can simply use the package already available in the “saucy” repository:

Reboot and you’re all set!


Upgrading to 3.11 does not fix neither the sound nor the brightness problem… or at least not with the rc7. Yet running dmesg you would find an interesting message:

According to what I found on some commit messages, enabling this option in the kernel build configuration might solve the sound issue. I’ll try tomorrow and give you an update! If you have any hint on the sound or the brightness issue please let me know.

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:


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:

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!