A few years ago, in academia and research, everyone ran Linux for their work. Since I've been at 99designs, we've been entirely a Mac shop on the desktop, even though our servers all run Linux (Ubuntu 12.04). Still, I believe in open source, and want to see Linux thrive. It was time to do my yearly experiment trying to work from Linux on my MacBook Pro.

The goal

I wanted to run Linux primarily so that I could run Docker natively. As someone who often runs experiments on my laptop, I'd prefer not to waste resources using a traditional VM. Plus, with an explosion of databases and distributed systems to trial for data processing, I wanted to be able to spin them up and down quickly.

On the side of all this, I wanted to use a next-gen filesystem like ZFS or Btrfs for cheap point-in-time snapshots, and for work it would have to use full-disk encryption. For something that would work in the long term, I preferred a rolling release distro like Arch to Ubuntu. Personally, I haven't been comfortable with Ubuntu's desktop experience since Unity was introduced.

A long journey

I had a few attempts before I arrived at my working system. Here's what I tried, in order:

Dual boot Arch (ZFS-on-LUKS, MBR) with OS X

I had to use a Windows 7 install DVD to get Boot Camp to agree to make a spare partition on the side of OS X. At some point in the process, this failed. When I attempted to repair the partitions using a boot USB, they were unrepairable. Now I was truly committed. I nuked the partitions and decided to do a Linux-only install.

Arch (ZFS-on-LUKS, MBR)

It being my first time with Arch, I followed their installation guide. This was like a choose your own adventure game, with a huge number of choice points and branching options. Although I seemed to be able to set things up, I had ongoing issues booting from my ZFS volume. I decided Arch was too much work, and went back to old, reliable Ubuntu.

Ubuntu 13.10 (ZFS-on-LUKS, MBR)

I was more familiar with Ubuntu, and tried an encrypted ZFS setup guide. I soon got a working desktop setup, which I immediately destroyed trying to switch from Unity to another desktop manager. I worked out how to scrub PPA packages, got Gnome3 working and began setting up my normal directory structure from backups.

As my two Dropboxes finished their sync, I began to get some alarming crashes. All 16GB of memory was being eaten up, doing not much at all. I guessed ZFS was the culprit, since it uses it's own ARC cache for disk which doesn't free memory as readily as the normal kernel cache. After ongoing troubles trying to fix the problem, I decided to start again with Arch and Btrfs.

Arch (Btfs-on-LUKS, MBR)

This time around, everything went very smoothly, as if I was going more with the grain of the system. Plus, I'd already been through the install procedure a few times, so the cognitive burden was lower. I put together a working desktop using Cinnamon, and finally thought "this could be it!" Before I committed, I read up more on my hardware, and found that the dual graphics capability of my MacBook Pro would only be usable if I used GPT partitions and a UEFI bootloader. How much harder could that be?

Arch (Btrfs-on-LUKS, UEFI)

This was almost the same as before, but needed a special UEFI dos partition as well as the usual boot partition. Getting this populated the right way was a pain, until I discovered Gummiboot. Things began working again for me, and in short order I had a functional desktop with all the files I needed. I nearly fell out of my chair when suspend worked without any configuration.

Remaining issues

The wifi is still a little flakey: I run a script to monitor it and turn it off and on again periodically when it drops out. My external 27" thunderbolt monitor works, but only if I reboot the laptop with thunderbolt connected. A special tool called acdcontrol is needed to manage its brightness. So, there are still some issues, but none of these are showstoppers.

Reaping benefits

Was it worth all this, along with the inconveniences? I think so. Docker's been naturally easy to install and use, and it's been great to be without a VM. Arch's core package system is a pleasure, and is augmented by a huge number of user-contributed packages. Using snapper on Btrfs means I have Time Machine-like snapshots of my machine state every hour. This is like version controlling everything you do, for free. It's quite amazing!

So, although I'm more appreciative than ever of what OS X provides by default, I'm thoroughly enjoying this new setup for now.