Adelie Linux on 2007 MacBook Pro


And now for something a little different.

Background

Just over a year ago, someone gave me an old MacBook Pro which they no longer wanted free of charge (quite literally -- zero cost, no battery and no power cable). When I got it, it was running OS X 10.11 El Capitan, which was useful enough at the time for doing portability testing for some code I was working on. However, El Capitan recently became unsupported, so I decided I'd like to put an operating system without known RCE-over-TCP vulnerabilities on it.

Most of the interesting hardware I've been playing with recently has been 32-bit PowerPC hardware, for which my usual weapon of choice is OpenBSD, but seeing as this is a 64-bit Intel system, my choice of tools here is somewhat broader (though the Nvidia GPU caused me some grief later down the line).

As the title of this post suggests, I eventually got Adelie Linux running on this machine, but I had to try several things before I managed to make that work.

Firmware

The MacBook's firmware is pretty fickle, but only if you don't understand its quirks.

I could get neither Adelie's 64-bit installer nor 32-bit installer to boot on the MacBook, either from USB or optical disk, so I initially ruled that out. I could get OpenBSD's installer to boot from a CD, but not from USB, as the former boots in PC BIOS mode and the latter boots in UEFI mode, and the OpenBSD UEFI bootloader would hang when loading the kernel. The Arch Linux installer was the other way round: it would boot (implicitly in UEFI mode) from a USB device, but not from a CD (in PC BIOS mode).

The MacBook's hard disk was partitioned with a GPT partition table and set up for UEFI booting, and as I didn't really understand what the firmware was doing at this point, I decided to keep it that way. I started by booting OpenBSD in BIOS mode and installing to the hard disk, however this made a UEFI installation, which failed to boot like the installer did. I briefly considered attempting to try booting the kernel with a magic boot disk like I did for the PowerMac, but I decided to try some other things first.

I then wiped the OpenBSD partition and reinstalled Arch Linux in UEFI mode. This had the advantage of actually booting properly post-installation, though the graphics froze up shortly after boot, and after some quick googling I had to add nomodeset to the kernel command line to prevent this happening. This was all well and good, but I couldn't get Xorg to work, as the nouveau driver complained about the lack of modesetting. I switched to using the proprietary Nvidia drivers, but that didn't solve the issue, as they detected the graphics card properly but were unable to actually perform any accesses on it.

Note that at this point, I actually had a readable console, which in hindsight I'm pretty sure is a result of the EFI framebuffer interface the firmware gives to the operating system when booted in UEFI mode. I eventually discovered (somewhere) that the Linux drivers (both open source and proprietary) for GPU's of this vintage require the machine to be booted in BIOS mode. (I don't know why precisely, but I suspect it's due to some strangely low-level hardware access or reliance on some firmware interface which is provided by the PC BIOS and not UEFI.) It also seemed like the EFI framebuffer was responsible for the nouveau driver's troubles.

At this point, I wasn't sure how to get the MacBook to boot in PC BIOS mode, so further googling ensued, until I found this post on the Arch Linux forums, which answered my questions. I then reinstalled Arch in BIOS mode and installed the proprietary driver along with the rest of the system, which resulted in a system which booted and gave me working Xorg. Huzzah!

From Arch to Adelie (take I)

At this point, I decided I would try to switch the installation to Adelie in-place, however this didn't quite work out. I booted back into the Arch installation image, and loaded the 1.0-BETA-1 rootfs tarball for x86_64 onto another USB device. I mounted the hard disk, and did something rather crude like mkdir oldinst; mv * oldinst. I then extracted the the Adelie tarball onto the hard disk, chroot()ed in, and configured the system. It took a few tries to get GRUB configured correctly, but eventually I had a bootable Adelie system. However, I couldn't get my network configuration to work correctly (which was a bug in interactions between wpa_supplicant and netifrc, the fix for which was independently released shortly after I tried this) and I realised that the proprietary Nvidia driver only works on systems using glibc, as it includes precompiled binary blobs. I therefore decided to revert to the Arch installation and use that.

From Arch to Adelie (take II)

I came back to the MacBook a few days later and realised that I never tested the nouveau driver running under BIOS mode. When I realised that this worked just as well as the proprietary driver, I decided to give Adelie another shot. I repeated all of the above steps to get Adelie back onto the MacBook, including putting nouveau in the list of required modules in /etc/update-extlinux.conf. By this point, the wpa_supplicant package had been fixed, so I was able to get the MacBook into a state where it would boot, give me a sensible console resolution, and the network configuration would work properly. However, as of this writing, Adelie is still in beta, so some extra tweaking was necessary before I got the machine into a usable state with a working desktop environment.

I opted to install LXQt, as I couldn't get XFCE working (known Adelie bug in xfwm4), which required the following packages:

I also had to patch the startlxqt script to make it work correctly, but there's a known fix which should be issued soon.

Adelie is still an evolving system, so things will changed, tweaked and refined -- watch this space...



home