Using Linux on a Macbook Air

I made the switch to Linux in ~July 2021, and over the past 7 months or so I’ve learned some things about setting it up on my MacbookAir6,2 (mid 2013) to get the best battery life and overall quality-of-life stuff.

Slow Wakeups

The main, and almost deal-breaker issue for me was initially a slow wakeup from sleep. After a lot of digging around I started to check the logs from during a wakeup using journalctl. What I found was that the OS kept trying to access a usb device…but I didn’t have anything plugged in (note to self: I should probably add the actual error in here…except then I’d have to recreate it!). What I eventually found (via the Arch Wiki) was that Linux has poor support for Thunderbolt ports, and leaves them powered on. When awaking from sleep, the OS kept pinging the port and finding nothing. I disabled it using a kernel boot option through rEFIND (my bootloader).

To do this, I created a file /boot/refind_linux.conf (this might already exist if you installed rEFIND in Linux…I installed it via my macOS partition). Within this file, I added the following boot options:

"Boot with standard options"  "root=UUID=9a918053-99e4-4092-b9ff-d55a2e161147 ro quiet splash acpi_osi=!Darwin"
"Boot to single-user mode"    "root=UUID=9a918053-99e4-4092-b9ff-d55a2e161147 ro acpi_osi=!Darwin single"
"Boot with minimal options"   "ro root=UUID=9a918053-99e4-4092-b9ff-d55a2e161147"

The key here is the acpi_osi=!Darwin. Adding this option disabled the Thunderbolt port. I can still get an external monitor through the port, but if I actually had any Thunderbolt devices they wouldn’t work. After disabling the port, the sleep issue was fixed. Also…as the Arch wiki notes, I did see a ~3W reduction in idle power usage (from 12W to 9W…which is pretty big!)

Webcam

The webcam doesn’t work out of the box. You’ll need to compile a driver. You’ll need to do this for every kernel update too. I found this script, and despite the fact that it should run every kernel update if you put it in the right directory (some systemd hooks directory), that has never worked for me so I just manually run it any time I update a kernel (which isn’t very often I suppose). You need to have the kernel headers, and also run this with sudo.

#!/bin/bash
set -e

export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')

temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
cd $temp_dir
git clone https://github.com/patjak/facetimehd-firmware.git
git clone https://github.com/patjak/bcwc_pcie.git

cd $temp_dir/facetimehd-firmware
pwd
make
make install
cd $temp_dir/bcwc_pcie
pwd
make
make install
rm -rf $temp_dir

if [ ! -d "/etc/modules-load.d" ]; then
  mkdir -p "/etc/modules-load.d"
fi

cat > "/etc/modules-load.d/facetimehd.conf" << EOL
videobuf2-core
videobuf2_v4l2
videobuf2-dma-sg
facetimehd
EOL


# Workaround for depmod being skipped above with error:
# Warning: modules_install: missing 'System.map' file. Skipping depmod
echo "Generate modules.dep and map files"
sudo depmod

echo "Adding kernel modules"
# sudo modprobe -r bdc_pci
sudo modprobe facetimehd

echo "Install complete"

Trackpad

Just use libinput. That’s it. I don’t like the default scroll speed, but I use KDE which lets me modify that through the GUI, at least in a Wayland session it does.

~rockorager