Mac mini (2010) bookworm

· 3min · Pasi Lammi

New OS for legacy device

A few weeks ago, I bought an old Mac mini for desktop use. In the IT world, a 15-year-old device is considered legacy.

Using old devices for tasks that don't require much power is an environmentally friendly choice. It avoids the need to use lots of materials to build new ones when useful options are available at a good price.

Here's what we have: a nice-looking device with an Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz, 8G memory, and an older Nvidia GPU.

I wanted an up-to-date OS, so I selected Debian 12 (a.k.a. bookworm). The installation went smoothly through the EFI boot menu with a nouveau-based driver. To make the fan quieter, I installed mbpfan.service to balance fan speed based on device temperature.

While looking at kernel logs, I noticed some warnings regarding the GPU driver. Nouveau is a good replacement for Nvidia's original non-free drivers, but its performance is not the best. Recently, I have been working on a 3D model game project at school (Haaga-Helia) and I want to use this machine to run my game on a native Linux binary.

Nvidia divers

Getting the Nvidia driver to work properly required more than just installing some extra packages. The Debian wiki provides instructions for bookworm's Nvidia driver package version 535.183.01. The installation went smoothly, but when the kernel module tried to load, the driver indicated that this legacy device is not supported by this version.

Mar 09 23:38:36 mmini kernel: NVRM: The NVIDIA GeForce 320M GPU installed in this system is
                              NVRM:  supported through the NVIDIA 340.xx Legacy drivers. Please
                              NVRM:  visit http://www.nvidia.com/object/unix.html for more
                              NVRM:  information.  The 535.216.01 NVIDIA driver will ignore
                              NVRM:  this GPU.  Continuing probe...

At this point, I had two options: download the driver from Nvidia and figure it out myself or use Debian's method to install the drivers. I chose Debian's method to keep track of changes via the package manager.

Since these old legacy drivers were not available in binary packages, I had to build them. As with other software development tasks, I typically use containers to build things, so I decided to build deb packages similarly to avoid messing up my servers and workstations with build packages and compile-time requirements.

When Nvidia-legacy-340-* packages aren't available on Debian bookworm, we need to use unstable source packages to build them. Using these "unstable" version packages with bookworm requires matching compile-time parameters and package information to the current bookworm tools versions.

Multi stage Dockerfile

After deb packages have been built, packages need to be located somewhere so my mac mini able to download packages with standard debian way like apt install or apt-get install. I was select to use multi state Dockerfile to first build packages and then second stage to build small container image which include nginx and have all those packages. This way i could run container on other machine and connect from my Mac mini machine. This container way give me opportunity to keep this container image stored on my own local container repository and event start the container based on http income trigger.

Docker build scripts: bookworm-nvidia-legacy-340xx-driver

Debian repository setup

Start temporary container on my server side

pashi@srv1:~/src/nvidia-legacy$ podman run -d --rm --name nvidia -p 20080:80 nvidia-legacy-bookworm 
24d92d6d960121e8c48f6e3b74e8e0c8b047336c2efdc71f142ecd96aab3742e

And setup apt repository to my mac mini

root@mmini:~# echo 'deb [trusted=yes] http://192.168.1.6:20080/ bookworm non-free' > /etc/apt/sources.list.d/nvidia.list
root@mmini:~# vi /etc/apt/sources.list
root@mmini:~# apt-get update
Ign:1 http://192.168.1.6:20080 bookworm InRelease
Get:2 http://192.168.1.6:20080 bookworm Release [741 B]
Ign:3 http://192.168.1.6:20080 bookworm Release.gpg               
Get:4 http://192.168.1.6:20080 bookworm/non-free amd64 Packages [9,667 B]                                            
...
root@mmini:~# apt install nvidia-legacy-340xx-driver nvidia-settings-legacy-340xx
...
Get:1 http://192.168.1.6:20080 bookworm/non-free amd64 nvidia-legacy-340xx-alternative amd64 340.108-24 [73.2 kB]
Get:2 http://192.168.1.6:20080 bookworm/non-free amd64 libnvidia-legacy-340xx-cfg1 amd64 340.108-24 [128 kB]
Get:3 http://192.168.1.6:20080 bookworm/non-free amd64 libnvidia-legacy-340xx-glcore amd64 340.108-24 [7,001 kB]
Get:4 http://192.168.1.6:20080 bookworm/non-free amd64 libgl1-nvidia-legacy-340xx-glx amd64 340.108-24 [460 kB]
Get:5 http://192.168.1.6:20080 bookworm/non-free amd64 libnvidia-legacy-340xx-eglcore amd64 340.108-24 [6,980 kB]
Get:6 http://192.168.1.6:20080 bookworm/non-free amd64 libegl1-nvidia-legacy-340xx amd64 340.108-24 [223 kB]
Get:7 http://192.168.1.6:20080 bookworm/non-free amd64 nvidia-legacy-340xx-driver-libs amd64 340.108-24 [71.4 kB]
...

New drivers in use

After boot new drivers working as expected.

root@mmini:~# dmesg |grep nvidia
[    2.838203] ehci-pci 0000:00:04.1: disable ppcd for nvidia mcp89
[    2.862512] ehci-pci 0000:00:06.1: disable ppcd for nvidia mcp89
[   23.443337] nvidia: loading out-of-tree module taints kernel.
[   23.443356] nvidia: module license 'NVIDIA' taints kernel.
[   23.462133] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[   23.561913] nvidia 0000:05:00.0: enabling device (0006 -> 0007)
[   23.562469] nvidia 0000:05:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[   23.586336] [drm] Initialized nvidia-drm 0.0.0 20150116 for 0000:05:00.0 on minor 0
[   25.239571] audit: type=1400 audit(1741557015.933:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=362 comm="apparmor_parser"
[   25.239584] audit: type=1400 audit(1741557015.933:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=362 comm="apparmor_parser"

And godot

Godot Engine v4.3. stable.official.77dcf97d8 - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 340.108 - Compatibility - Using Device: NVIDIA - GeForce 320M/integrated/SSE2