Apple have long stopped supporting the mid-2011 mac mini I had sitting in the living room, so rather than contribute to the e-waste problem I decided to stick linux on it. The general consensus seems to be that you should keep macOS bootable to make it easier to deal with any firmware issues down the line, so I wanted to set it up to dual boot. The documentation I was able to find on how to do this seemed scattered or out of date.
There are a number of little wrinkles to this process:
- macOS quite reasonably assumes it'll be the only thing running on the machine; you need to install a boot manager to let you choose between macOS, linux, or whatever else. I went with rEFInd.
- Something seems a bit off with the default video setup, such that when I first booted into Debian the screen went blank immediately after enabling kernel modesetting.
- The mac mini wifi uses a Broadcom chipset with non-free drivers which you have to download separately. I solved this by putting them on a separate USB stick. It might be possible to get around this by just using the wired network - I don't know if this needs the nonfree drivers as well, and I didn't try it because I'd have had to carry everything downstairs and find a switch port to plug into.
At this point I've not tried to get graphics or sound working, because I only wanted a headless server box.
This isn't really difficult but it is a bit of a faff and you could wind up bricking your machine if you're not careful. Please back everything up beforehand, and bear in mind that these notes are primarily so I can remember what to do if I ever need to do this again rather than some sort of general user guide; I am not responsible for anything you do as a result. It's very likely that there are easier ways of doing some of these steps that I was unaware of.
Here's what I had to do in the end.
You will need the following:
- 2011 mac mini (this might work for other sorts but I've not tried)
- Two USB drives which you're prepared to wipe, one with at least 4GB capacity, and another one which can be smaller (at least 15MB)
- Ideally another machine nearby you can use to look things up on, or re-write USB images etc
- A cup of tea or the makings thereof
- A few hours
- Firstly, upgrade macOS to the latest version available. In this case that meant High Sierra.
- Download the rEFInd boot manager binary zip file from here
- Unzip it and run the
refind-installscript. If you run it as a non-root user and you've already runsudorecently then it will take advantage of this, otherwise it will run sudo itself and prompt for a password. - Download http://lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2 and put it on the smaller USB drive.
- Open Disk Utility and repartition the disk.
- I went for the following partitions, not including the special partitions for EFI/restore which Disk Utility won't show you and which you should leave well alone!
- resized the macOS partition to 200GB
- 1GB for
/boot - 32GB for swap
- 100GB for
/ - everything else in one big partition which I planned to split up in LVM later
- Note that once you set a partition type to eg "MS-DOS", Disk Utility will not let you change its size (I assume because it doesn't know how to do the equivalent of
resize2fs?). You can just leave everything as APFS.
- I went for the following partitions, not including the special partitions for EFI/restore which Disk Utility won't show you and which you should leave well alone!
- Maybe reboot, admire your new rEFInd boot screen, and double-check that everything still boots into macOS ok.
- Download the installer ISO image from here . You want the amd64 image of DVD number 1; you don't need any of the subsequent DVD images, just the first.
- Plug in the larger USB drive and figure out which device it corresponds to. I did this by typing
diskutil listand looking for the one saying "external, physical". - write the image by doing something like
dd if=debian-12.6.0-amd64-DVD-1.iso of=<device> bs=1m.
- Reboot; choose the USB image which should take you to the Debian installer.
- If it asks you to supply extra firmware just say "no"; we will sort this out later. Tell it not to set up any network.
- Set the install going and have that cup of tea while it runs.
- Once the install process has finished, reboot
- In grub, hit
eto go to the screen where you can set kernel parameters to avoid the blank screen.- There should be a line saying something like
linux /vmlinuz-6.1.0-23-amd64 root=UUID=<blah> ro quiet. - Change the params from
roonwards toro nomodeset text - Press F10 to continue booting
- There should be a line saying something like
- Log in as root. Make sure the installation USB is still plugged in;
fdisk -lwill tell you which device it's on, then you can do something likemount -tiso9660 /dev/sdb1 /mnt/usb - Go into the mounted USB and
dpkg -ifirmware/firmware-brcm80211_20230210-5_all.deb cd pool/contrib/b/b43-fwcutterand thendpkg -ithe two non-legacy debs.- Mount the smaller USB, untar its contents somewhere, then
b43-fwcutter -w /lib/firmware broadcom-wl-5.100.138/linux/wl_apsta.o - Reboot.
- Log in as root and check that
nmcli dshows a disconnected wifi device - Connect to your access point with
nmcli device wifi connect <network name> password <password> - It should now work! Check by eg
ping www.google.com
- You probably don't want to have to edit the kernel parameters every time, so:
- edit
/etc/default/grubto setGRUB_CMDLINE_LINUX_DEFAULT="nomodeset text" - run
/usr/sbin/update-grub
- edit
- You may have noticed that after running the Debian installer the machine booted straight into grub rather than going through rEFInd. I fixed this at the time by booting to macOS and reinstalling rEFInd; you could also fix it from the Debian side, or just live with it.
At this point you should have a working networked Debian install and what you do is up to you; the next steps I'd personally take would be something like:
- update
/etc/apt/sources.listaccording to the instructions and runapt-get update && apt-get upgrade - Grant sudo access to the non-root user with something like
usermod -aG sudo <username> - Set up LVM
- Make it boot into text mode rather than bringing up a GUI, with
systemctl set-default multi-user.target - Remove any unnecessary packages by browsing the list in
aptitude. Beware that when I tried to remove all the X11-related stuff it decided to take outnetwork-manager- always carefully check the list of packages it wants to uninstall! - Install
mbpfanandpowertopand make sure power management is enabled, because you don't want your little living room server to be constantly and unnecessarily spinning its fan - Go have a stiff drink or other celebratory ritual of your choice