Goodbye Mac OS X, Welcome Arch Linux!

Archlinux

 

Hi friend!

Before you go on on please take a second to match a few statements with your profile for the benefit of your reading time.

You:

  • Do not own the latest and greatest filled-with-bells-and-whistles Apple machine and, most importantly, you don’t intend to, at all: there’s just enough garbage in this world and you’re dead-tired of producers that don’t take care of their product’s lifecycle in a planet-preserving fashion
  • Are fed up with the latest Apple computer OSs and their puzzling resource black holes
  • Can proudly assert that you’re not quite a technology illiterate but, on the other hand, you’d rather create than hack and don’t intend to spend a second on absurd machinery (unless it’s not too much, it’s fun enough and there are BIG advantages after doing so)
  • Would prefer upgrading your system continuously, in small and controlled steps rather than embarking on a lengthy upgrade procedure with little or no insight about what’s going on and, even worse, without knowing if your much needed working environment is going through uninjured
  • Dream of a fast package system because you’re tired of lengthy registry updates and eternal package installation bureocracy
  • Would like a port system for the cases where you want control over the package building process or need more exotic (or esoteric) stuff
  • Are comfortable with just the stuff you need and would like to spare some disk space by leaving out the rest (or at least be given a chance to)
  • Can’t understand why the exact same software is getting bigger and slower all the time and dream of a system where eveything runs as fast as modern machines can and take just the right amount of space

What do you think, are you going to read on? Then welcome!

I chose to give a chance to Arch Linux on my Macbook Pro 5,1 from 2008 to eventually replace the latest shiny and prodigal Mac OS Xs. Arch is Linux distro I knew already for its great simplicity, power and economy in the past and that’s why I decided to use it as a replacement OS for what is still a great machine.
In the past, though, Arch Linux had to be installed from the command line of a less-than-minimal install CD and the process took quite some time in the range of a few hours to a few days (depending on the level of customization). Nowadays we’ve got Antergos providing an Arch Live CD and GUI installer.

Still, installing Arch on Macs is not the easiest possible tech journey, that’s why I decided to spare you some grief and headaches after going through them myself. There are quite a few moves to take but trust me that it’s well worth it, as Arch+Mac is just the slickest workstation ensemble you could possibly think of. And especially so if you’re an IT creative.

First of all, you should know a couple of things about your machine, i.e. MBP 5,1:

  • It’s a (Mac) EFI machine, which means it’s got a more modern firmware than BIOS-based ones and it can boot a pre-OS environment from a dedicated VFAT partition. It can boot in BIOS mode as well for the benefit of older operating systems though, and these two modes are seemingly wildly different, especially when it comes to what makes them crash.
    I had to install in BIOS mode with specific kernel boot options but the normal running mode should be EFI with different options.
  • It’s got two graphics cards, both NVidia, 9400 and 9600; the first one is slower but cheaper on power while the second has, of course, the opposite features. The machine will list the most powerful card first, which means that the Linux drivers will see just the first one.
    It looks like there are ways around to disable the first card and use the second card like this one using GRUB (have a look here https://bugs.freedesktop.org/show_bug.cgi?id=27501 and https://help.ubuntu.com/community/UEFIBooting#Selecting_the_graphic_card) but I couldn’t make it work and I just gave up.
    Double-gfx machines are not very well supported by Linux so far but there are ongoing efforts (have a look here http://linux-hybrid-graphics.blogspot.com.es/2012/04/apple-macbook-pro-and-linux-hybrid_21.html).
  • There are two drivers for these cards, the open-source “nouveau” and the proprietary NVIDIA ones. Needless to say, “nouveau” is better integrated with the system but supports less models, while NVIDIA drivers have wider support but will break a few things. It looks like 9600 is not supported by “nouveau” yet, so I had to choose NVIDIA.
    Unfortunately the NVIDIA driver will destroy your text mode console once you load X and you’ll suffer from artifacts if you logout and login again but it’s still better than nothing.

So here’s the recipe:

  • Boot from a Mac OS X disk by keeping the “ALT” key pressed down during poweron  (I had to do so using an external drive as my internal one is long gone)
  • Resize the main Mac OS X partition to leave some space for your Linux one
  • Boot into Mac OS X
  • Install the latest refind EFI boot manager (http://www.rodsbooks.com/refind/getting.html, will allow you to boot a Linux kernel directly) in the EFI partition including all the filesystem drivers: install.sh --esp --alldrivers
  • Install Mac OS X gpt disk, quite useful http://sourceforge.net/projects/gptfdisk/files/gptfdisk/0.8.7/gdisk-binaries/gdisk-0.8.7.pkg/download
  • Download the latest antergos x64 ISO http://antergos.com/try-it/
  • In a terminal, as root, convert it to an USB stick image (I couldn’t boot it from a CD) using hdiutil: hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/antergos.iso
  • Write to the USB stick (be sure about disk paths and that you can erase the stick completely without loosing important data): dd bs=4m if=<your img file> of=<your stick raw disk device, most probably /dev/rdisk1>
  • Reboot and boot in legacy legacy (= BIOS compatibility mode) USB from refind with wired network connected (wireless won’t work initially as there’s no firmware included)
  • Set your preferred language and add the following kernel boot parameters: acpi=off nomodeset reboot=pci (in BIOS mode they are needed to avoid locks); the last param avoids lockups when doing reboots
  • Choose graphical install with GNOME; remove the recovery OSX partition and create one ext4 partition to be used as the root (“/”) mountpoint and one swap partition; the installer will need to download a lot of stuff but the system will be up-to-date already when it finishes
  • After the install has finished, open a terminal
  • Update the packages DB: pacman -Sy
  • Install arch-chroot: pacman -S arch-install-scripts
  • Move into the installed system: arch-chroot /install
  • Remove nouveau: pacman -R xf86-video-nouveau nouveau-dri
  • Install nvidia and some other useful stuff (I love cinnamon), including the source port tool “yaourt”: pacman -S base-devel yaourt abs mc htop nvidia gptfdisk cinnamon syslog-ng
  • Install pommed for Mac keys like volume etc.: yaourt -S --noconfirm pommed
  • Install the wireless firmware: yaourt -S --noconfirm b43-firmware
  • Enable Bluetooth: systemctl enable bluetooth.service
  • cp /boot/grub/grub.cfg /boot/refind_linux.conf, edit and leave kernel line alone with nomodeset reboot=pci additional params; DON’T use apci=off as it breaks in EFI mode
  • Reboot and choose the penguin icon from refind
  • That’s it!

You can go from there by following a few useful arch guides by starting with the MacBook main page: https://wiki.archlinux.org/index.php/MacBook

I found useful to install and enable services for laptop mode tools, sensors, acpi, syslog, cpupower, bluetooth, audit, pommed, dkms (so that I could have, e.g., virtualbox host modules automatically recompiled at boot whenever the kernel gets upgraded).

You can make suspend to disk (hibernate) work as well by tweaking the /etc/mkinitcpio.conf file, adding resume to the HOOKS list, adding resume=<swap device> to your kernel parameters in /boot/refind_linux.conf and then running minitcpio -p linux.

Have good fun with your brand new Arch Linux MacBook Pro 5,1!

Leave a Reply