Linux Mint Installation on Imac 10,1 (late 2009)


Introduction/Motivation

A while ago, I received a relatively old iMac from a friend who originally intended to dispose of it. Luckily, he hadn’t forgotten that I might be interested in it. My initial plan was to use the old machine to run older macOS music software – some of which is no longer supported by newer Macs. However, it’s certainly nice to have a recent and secure system on an older device – a computer as a backup system is always practical, and you shouldn’t be doing anything online with the ancient macOS. So, I simply installed a modern Linux system as a dual boot.

Hardware/MacOS

https://support.apple.com/de-de/112565

https://linux-hardware.org/?probe=dc0cf19a8e

The iMac was slightly modified – additional memory (12 GB total), a 500 GB Samsung 850 EVO SSD. Overall, it’s a device that should be perfectly adequate for daily work. The only drawback is the rather weak dual-core processor (3.06 GHz Intel Core 2 Duo). With newer models, it’s possible to completely reinstall macOS via the internet/WAN. This device is too old for that, so a reinstall via USB drive was necessary. If desired, one can try updating to macOS Sequoia using the open-source Legacy Patcher. However, the linked video demonstrates the process for a computer with an Nvidia card, not the ATI Radeon card that’s installed in my iMac. Honestly, I’m not a fan of it at all, because the performance with Linux Mint Xfce is perfectly fine – without any problems once you’ve overcome the boot issues mentioned later. Nevertheless, this option shouldn’t go unmentioned.

Preparation/Backup

The most important point for installation, updates, and general tinkering: Backup, backup, backup!

If you’ve backed up your data beforehand, you can tinker without worry. It’s also always fine to have a second computer (laptop?) available to create additional bootable media. I prefer to use Ventoy for booting – however, it turns out that Windows 11 fails to install on certain hardware configurations. This is off-topic, but worth mentioning. If you want to be on the safe side, create the bootable media using the respective system.

Problems/Tools

The first problem is the iMac’s usually enabled SIP (System Integrity Protection).

https://rodsbooks.com/refind/sip.html

In my case, I didn’t have a working recovery installation – so using Refind and a bootable medium was necessary. Once this block is removed, a boot process and installation are possible – including the installation of an alternative EFI bootloader.

For practical reasons, I recommend using refind as your bootloader. The easiest way to install refind is from within a running macOS system. Therefore, it’s advisable to install refind from your current macOS installation before installing Linux.

https://www.rodsbooks.com/refind

https://www.rodsbooks.com/refind/getting.html

Unfortunately, a relatively small but important adjustment is necessary during the boot process to boot Linux without problems using the graphics card. This is due to the iMac hardware’s EFI handling. It only allows certain access briefly during the boot process, and not afterward. In current Linux kernels, the graphics hardware is accessed via the kernel during boot. On this iMac, this results in necessary settings being inaccessible and the graphics output being corrupted after booting. This can be prevented by either manually adding the “nomodeset” option to the bootloader or by booting into “Safe Mode.” Then, Linux can be started on the iMac as usual and the installation performed – either alongside the existing macOS or directly on the entire hard drive. Unfortunately, Linux assumes that it can boot via EFI, which, due to the hardware’s specific configuration, leads to problems.

Normally (at least with a Linux Mint installation), the Linux bootloader grub, will take over UEFI and control the boot process. This isn’t a problem on “normal” PCs, as settings can be configured in the BIOS. Unfortunately, this isn’t so easy with this iMac. Fortunately, there’s efibootmgr. If booting in EFI mode (either via the installation on the hard drive or from a USB drive), efibootmgr can be used to set the boot destination.

https://codelucky.com/efibootmgr-command-linux/

Alternatively, you can still access the iMac boot menu by holding down the ALT or OPTION key and rebooting into the macOS installation. Then you can reinstall refind from within macOS.

To boot via EFI using refind without constantly having to enter the “nomodeset” option, you can permanently set this option in the Linux installation file:

/boot/refind_linux.conf

https://www.rodsbooks.com/refind/linux.html

To do this, you should install the Debian package in your Linux installation. Using mkrlconf, you can automatically create the refind_linux.conf file. In my case, the “nomodeset” option was inherited directly from the boot process and written to the file. With the “--force” option, mkrlconf will recreate this file if it already exists. This is what my configuration file looks like:

"Boot with standard options" "ro nomodeset root=UUID=0adfd422-801a-4fff-b807-dad918fa970f"

"Boot to single-user mode" "ro nomodeset root=UUID=0adfd422-801a-4fff-b807-dad918fa970f single"

"Boot with minimal options" "ro root=UUID=0adfd422-801a-4fff-b807-dad918fa970f" Of course, these are the UUIDs of my root partition.

Solution

As you might guess, the solution is to boot via legacy boot. Unfortunately, this isn’t so easy on a GPT disk. If you don’t want to reformat the disk to legacy MBR and would prefer to keep the modern GPT structure, you’ll need to put in some extra effort. This requires an additional partition of approximately 1 MB on the disk. Simply create this partition without formatting it – for example, using gparted and the “bios_grub” flag.

https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html

To then install Grub for legacy boot, the following command is necessary in the Linux installation booted via EFI:

sudo grub-install --target=i386-pc /dev/sda --boot-directory=/boot

Replace /dev/sda with the disk (not the partition!!) on which the partition with the “bios_grub” flag was created.

After that, it’s also important to update grub to get the necessary configuration files:

sudo update-grub

It should now be possible to boot Linux via Legacy Boot – either by holding down the Option or Alt key (Windows as the operating system, yes!) or by using refind (the last option).

Minor Details

Well, perhaps something crucial. Apple has included a special feature in this iMac – an additional sensor for the built-in hard drive. If the cable and sensor are missing, the system thinks it needs to spin up all the fans to cool the CPU. This can all be fixed by installing mpbfan.

https://github.com/linux-on-mac/mbpfan

This little tool ensures you won’t be blown away by the iMac fans.


Leave a Reply

Your email address will not be published. Required fields are marked *