Installing Linux on a 2008 Intel-based iMac


This weekend I decided to install Linux on an early 2008 24-inch iMac (3.06 GHz Intel Core 2 Duo).

This machine was at some point upgraded to a 1TB HDD with 4 GB of RAM, but has been stuck on an outdated version of Mac OS X and thus for example limited to very outdated versions of Firefox. All in all, it’s functioned in recent years as little more than an elegant, oversized paperweight.

As the terabyte of storage was mostly unused, and it may be useful at some point to access the MacOS installation, I decided to build a dual boot setup.

I followed this guide to create the new root and swap partitions ahead of time from inside MacOS rather than in the Ubuntu/Mint installer, as well as downloading and installing rEFInd. This machine was running MacOS 10.9.5, pre-dating the introduction of System Integrity Protection (SIP) and thus there was no need to boot into Recovery mode to disable it.

While I tinkered with Macintosh computers in my childhood during the PowerPC era and use modern Apple silicon at work, I’m less familiar with Apple’s 14-year Intel era between the two, and I’ve never installed Linux on such a machine before. I was therefore relatively surprised as to how seamless the process was.

I opted to stick to territory as familiar as possible, and used a USB stick I had already recently used to install Linux Mint MATE Edition 21.1 Vera (based on Ubuntu 22.04 LTS). Everything worked out of the box (apart from WiFi until the automatically recommended Broadcom drivers were added) and, a bit more critically, proper fan control.

Just don’t let it overheat

This machine will run very hot on Linux without some mitigation, typically provided by either macfanctld or mbpfan, both available in the Ubuntu/Mint repositories, but primarily targeting MacBooks.

I first installed mbpfan via apt, as this one is more actively maintained. However, the machine ran quite a bit warmer than I’d expect and, I’m not sure the fans were running at all despite confirming the applesmc and coretemp kernel modules were loaded.

After some research, I removed mbpfan and opted for Anton Lundin’s fork of macfanctld, specifically modified to enable control of all 3 fans on the iMac:

git clone --single-branch --branch fan3 https://github.com/glance-/macfanctld.git
sudo apt build-dep macfanctld 
cd macfanctld/
make
sudo make install

I then ran sudo macfanctld -f and immediately noticed a difference. To automate this, I created a systemd service. I created shell script /opt/root-launches-macfanctld with contents:

#!/bin/sh
/usr/sbin/macfanctld -f

Then I made that file executable, and created another file named /etc/systemd/system/macfanctld.service:

[Unit]
Description=Mac Fan Control Daemon
Documentation=man:macfanctld(1)

[Service]
Type=idle
ExecStart=/opt/root-launches-macfanctld
Restart=on-failure
RestartSec=1

[Install]
WantedBy=multi-user.target

Finally, the service can be started and enabled, and thus launched by root at system startup moving forward:

sudo systemctl start macfanctld
sudo systemctl enable macfanctld

Finally, just for fun, I installed a simple dock as well as Amiga icons and metacity themes.

I also installed Mikhail Shchekotov’s “flying toasters” screensaver, a more faithful port the classic After Dark screen saver than that long bundled with xscreensaver.

Addendum

Performance has been very impressive considering the age of this machine. It’s definitely usable for browsing the web and playing music and video. I also did some writing and edited some icons in GIMP and the interface was surprinsgly snappy. Nonetheless, I’ve found one more issue.

When using ethernet, the wired connection becomes disabled after waking from suspend. After running sudo lshw -C network, I discovered I am using the sky2 driver. A few solutions/workarounds are possible.

In my case I added pci=nomsi,noaer to the GRUB_CMDLINE_LINUX_DEFAULT line in file /etc/default/grub and then ran update-grub. After rebooting, I confirmed this resolved the issue for me.

Another workaround is simply to remove and re-add the module, i.e.

sudo modprobe -r sky2 && sudo modprobe sky2

The latter could then be toggled manually or triggered by wake events in a systemd service or udev script.