Get Debian Bullseye and VirtualBox running on an older (2012) Mac Mini.
Installing Debian Bullseye
This was very easy.
As in “plug in the installation medium, boot with Option key held down, select installation medium, and follow the onscreen prompts” easy.
I used the
netinst image, and it complained about lack of some firmware. So I fixed it:
apt install firmware-misc-nonfree -y
As I am using this as a server, I have not tested things like audio or Wi-Fi, as I do not need them. I cannot say whether they work or not, but the installation of the non-free firmware may have done the trick if they were not otherwise working.
When I had it up and running, I did my usual Debian-not-on-a-Raspberry-Pi LUKS setup, with
I also disabled
hibernate, since I do not want these:
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
One thing on my list still to sort is to have the machine start automatically if there’s a power failure. (Update: done.)
I know, I know, there are better virtualisation tools than VirtualBox.
- I have .vbox images (and I know I can convert and import them)
- I’m familiar with VirtualBox
- I am not committed to VirtualBox forever! But I want to make the initial move now
So VirtualBox it is. For now.
Installing VirtualBox was a bit of a pain, as I could not use
apt. (For now, at least.)
I used the “other Linux” installer instead.
It complained about bindings, so I ran:
apt install python2.7 -y
And then ran the installer again.
I had to make a tweak to the .vbox file from the donor machine, to get the correct reference for the ethernet interface. For the first one, I used the GUI, and then copied-and-pasted for the subsequent VMs.
I registered it with VirtualBox with:
VBoxManage registervm /full/path/to/the/.vbox/file
To start VirtualBox on boot, and to start the VMs automatically, I followed this guide. It worked.
The gist is:
Add a systemd config file (below) to
/etc/systemd/system/vbox_vm_start@.service, replacing [myusername] with the name of the user account which will run this.
[Unit] Description=VirtualBox VM %I After=network.target vboxdrv.service Before=runlevel2.target shutdown.target [Service] User=[myusername] Group=vboxusers Type=forking Restart=no TimeoutSec=5min IgnoreSIGPIPE=no KillMode=process GuessMainPID=no RemainAfterExit=yes ExecStart=/usr/bin/VBoxManage startvm %i --type headless ExecStop=/usr/bin/VBoxManage controlvm %i acpipowerbutton [Install] WantedBy=multi-user.target
Find the name of the vm you want to start automatically:
VBoxManage list vms
This showed nothing for me, which I did not understand, but I knew its name anyway.
Enable it (so that it starts on boot):
systemctl enable vbox_vm_start@[vm_name]
Start it now:
systemctl start vbox_vm_start@[vm_name]
Check it is working:
systemctl start vbox_vm_start@[vm_name]
But haven’t you ruined a perfectly good Mac Mini?
I’m not sure installing Debian on anything counts as “ruining” it.
But, more seriously, no. I have not ruined it, so much as breathed new life into it.
I have a few Mac Minis, all of which have performed admirably. I’ve stuffed them full of RAM, put SSDs in them (or else using SSDs over USB), and they’ve been great.
They all get security updates, for now, but it can only be a matter of time before this changes. None can run the latest macOS.
I’d be more comfortable if, even though they are getting security updates, they had an up to date operating system on them.
And, since I do not need anything specific to macOS, running Debian on some of them instead makes sense to me. (The others will likely be retired for now.)
It also means I can overcome two nuisances:
- when running macOS, they will reboot automatically in the event of power restoration following a power failure, there is — as far as I know — no way to do a remote unlock of FileVault2.
- VirtualBox for macOS does not recognise VLANs, so every VM on a particular Mac Mini must be on the same VLAN. That has been fine, as I’ve just segregated the Mac Minis physically as necessary, but I want to see if there is better support under Debian, to give some added flexibility.
In any case, I haven’t touched the macOS installation, and instead I’m booting Debian from an SSD over USB.
Goal achieved, albeit with more testing needed.
It was a fun, simple project.
The longest part — for which you do not need to be in front of a screen or terminal — is syncing VirtualBox disk images (.vdi files) from one machine to another.