Macbook Pro 2015 with Arch Linux
I’ve been using the 2014 version for work for a while and I’m very satisfied with its screen, touchpad and battery life, so I bought a new one for my personal use on this Thanksgiving. Since it’s not issued by my company, I can do whatever I want to it, including installing my favorite linux distro — Arch Linux.
I plan to dual-boot both Arch and OS X. OS X is still the best OS for this awesome hardware.
The last time I installed Arch was on my 2009 Acer laptop, which was still using BIOS. Things has been changed a lot, everybody is using EFI now. Macbook is even more special — It’s using a special EFI implementation that’s not the same as PC laptops. My old experience of partitioning and GRUB installation doesn’t help at all.
Everything starts from creating a bootable USB with Arch’s ISO image. UNetbootin didn’t work for me. GNOME disk utility worked well. Or, you can simply use dd, as documented on USB flash installation media wiki page.
Arch’s Beginners’ guide and Installation guide still work for most of the cases. The exceptions are, as I mentioned above, partitioning and booting. I followed this article for partitioning and installing GRUB: Arch Linux on a MacBook Pro Part 3: Base Installation. Keep the MacBookPro11,x wiki handy, I find it very useful. The generic Macbook wiki doesn’t help though. I still have problems booting into Arch, which I will explain later.
My choice of desktop environment is GNOME. NetworkManager is a must-have to me. Just simply follow the instructions on the wiki pages. xf86-input-synaptics is less annoying than libinput for touchpad support. I’ll explain it later.
Fast to start up, with good battery life
Thanks to SSD, starting up the system is pretty fast. It took less than 10 seconds to get to GDM login screen. Sometimes I think it’s faster than booting OS X.
Battery life is awesome. Gnome underestimates remaining battery time at startup, showing only 3 to 4 hours with full battery. After using it for a while, the estimated battery extends. At the time of writing this section, there is 60% battery with 4 hours 13 minutes estimated battery life.
GNOME supports HiDPI out of box, some apps don’t
One of the reasons I bought MBP is its retina display. Texts are sharp and UI elements are crisp. GNOME supports HiDPI since 3.10 and improves in 3.12, but I haven’t had chance to try it with my old laptop. It looks great. Both GDM and GNOME Shell render beautiful. With Source Han Sans font (thanks to Adobe and Google), Chinese characters never look so good on Linux. I’m still struggling to find good sans and serif fonts, though :(
GTK 3-based apps support HiDPI screens well. GTK 2-based apps look less good. Sublime Text and Chrome don’t have appearance issues unless you open and save files — GTK 2 file dialog is ugly.
WINE doesn’t support HiDPI well. You can change DPI using winecfg, but it only affects texts. I uses it to play Heroes of Might and Magic 3, and it just doesn’t scale up.
I haven’t tried QT-based apps yet.
Touchpad support: this is not what I want
Did I mention one of the reasons I bought MBP is its touchpad? I like its smooth, responsive experience, especially the mulitouch gestures that switch among workspaces and trigger Mission Control/Launchpad. There is also a great feature that allows you to use three fingers to drag.
Chrome also supports OS X touch gestures very well. You can pinch to zoom in/out, use two fingers swiping horizontally to go back/forward. Scrolling is as smooth as mobile devices.
Let’s see how the touchpad works on Arch.
If you use Xorg, the first problem is choosing touchpad drivers. There are 3 options: xf86-input-synaptics, xf86-input-libinput, and xf86-input-mtrack. xf86-input-synaptics doesn’t support gestures with more than 2 fingers. xf86-input-mtrack can assign mouse buttons for swipe gestures. xf86-input-libinput supports swipe gestures with 3 or 4 fingers.
Sounds like synaptics is the worst. However, mtrack is not widely supported, which means you have to install it via AUR, and cannot change the settings in GNOME control center. The gestures supported by libinput are only available in Wayland, not Xorg. What’s worse, libinput doesn’t disable touchpad when typing on my MBP. So synaptics is the best choice if you are using Xorg.
GNOME supports touchpad gestures since 3.18. It only supports 4 fingers swiping up/down to swtich workspaces for now. The reason is that Wayland uses libinput as touchpad driver, which only supports 3 or 4 fingers swipe gestures for now. To fix the touch when typing bug in libinput, I forked the code and hacked it. See wip/fix-macbook-dwt branch. I also have other branches that disable tap-and-drag or support three-fingers-to-drag.
As of scrolling, GTK3-based apps seems pretty smooth. Chrome has experimental smooth scrolling support. However, the experience is worse than without smooth scrolling. Firefox has better smooth scrolling than Chrome. Scroll horizontally to go back/forward is not supported by either browser, neither is pinch to zoom in/out.
To recap, the best option is to use GNOME under Wayland, with my fixes of libinput, and Firefox. We can get three-fingers-to-drag, switch workspace gestures, and arguably smooth scrolling. The missing features are gestures to trigger Activity Overview, pinch to zoom in/out, and scroll horizontally to go back/forward.
Suspending is broken due to wifi driver
I cannot suspend the MBP because the Broadcom wireless driver, brcmfmac, cannot suspend the device. It can be confirmed by check the logs:
$ dmesg | grep brcmfmac
[ 466.167212] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
[ 466.167236] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1c0 [brcmfmac] returns -5
The wireless device won’t be working after suspending.
To work around this problem, disable the driver before suspend:
sudo rmmod brcmfmac
On wake up, re-enable the driver:
sudo modprobe brcmfmac
So annoying. People who do this must be true Linux lover.
The “`” key that is left to “1” is mapped to wrong key. You can’t type “`” and “~” by default. The solution is on the Apple Keyboard wiki. Add the following line to /etc/modprobe.d/hid_apple.conf:
options hid_apple iso_layout=0
The default keyboard layout maps command to super, and option to alt. I swapped them so alt is next to space. A traditional way of doing that is to use xmodmap and write your own .xmodmaprc. However Gnome resets keyboard mapping after login. The alternative way is using gnome-tweak-tool. It’s under Typing section. Note that if you use Wayland, the settings only work with native Wayland apps, such as GTK3 apps (and maybe QT5 apps, haven’t tried yet).
GRUB fails to load Linux kernel
I use the MacBook’s native EFI bootloader approach for dual-booting described on MacBookPro11,x wiki page. By setting GRUB partition as the boot partition, GRUB shows up by default, but it gets stuck on “loading initial ramdisk”. If you hold option key at start up, it shows a menu to let to choose which disk to boot with. Choose the default one and GRUB works fine. Seems like GRUB sees different disk paths in these two modes.
The good: Gnome and apps I use support HiDPI screen very well. Battery life is still pretty good. Booting is fast.
The bad: Touchpad is usable, not awesome. Missing multitouch gestures with 3 or more fingers. Scrolling isn’t smooth.
The ugly: Problems with booting and suspending. There are workarounds, but pretty irritating.