In a previous article, I explained how to use mplayer to record Internet radio broadcast non-interactively.
I got it working on my workhorse PC, but it suffered from using 100% of one core as mentioned in that article. I have 12 cores so this wasn't a disaster. But I thought I could shove the job to a less important computer and also have a backup means of recording. I have a very old Raspberry Pi 2B which was idle.
I tried installing the latest Raspberry Pi OS, but I couldn't write the entire image on the micro SD card. I think the USB to micro SD adaptor got too hot and caused sector errors towards the end. Maybe I should have limited the writing rate. Anyway I decided to use a lighter RPi distro: dietpi.
This installed and booted up fine. I had an issue with the default NTP server until I specified a regional pool. Then I encountered a series of problems:
Apt repos need to be signed
It couldn't update from the default Debian Bookworm archive because the signing key wasn't present. Normally this is provided by the distro but since this is dietpi they only provided keys for the repos they used. Or they provided an old key.
Cut to the chase: Install all the relevant Bookworm repos, you can find a definitive list of them at at various sites. If possible use a local mirror for the repos. Don't forget bookworm-security, but this will come from security.debian.org, not a mirror.
When you do an apt update it will complain about various unsigned repos. Note down the key fingerprints for the next stage.
Apt-key is deprecated
Ignore any tutorials that talk about using apt-key to install the required keys. For security reasons, apt-key is deprecated. The new way of doing it is:
Download the GPG keys for all the repos missing keys. You'll need to find a suitable keyserver with the Debian keys.
Feed each through gpg to dearmor the keys and write the output to a suitably named file in /etc/apt/trusted.gpg.d/ Here's what I have:
root@DietPi:/etc/apt/trusted.gpg.d# ls
bookworm-security.gpg debian-bookworm-archive.gpg dietpi.asc
bullseye-security.gpg debian-bookworm-stable.gpg raspberrypi-archive-stable.gpg
deb-multimedia-keyring.asc debian-bullseye-archive.gpg raspbian-archive-keyring.gpg
I haven't given the details to avoid duplication and because I could have forgotten some bits. You can find them in up-to-date tutorials.
You need Deb multimedia
Mplayer uses some codecs that are not supplied in Debian, so you have to get them from Deb Multimedia. Use a mirror if you can. You need to install the signing key for this in the same manner shown above.
Finally install mplayer
Do an apt update and then apt install mplayer. If you have any issues at the update step, fix those. I came across issues like mirrors no longer existing, or didn't specify their Debian repo domain in their list of alternate domain names which caused failure on verification.
Also any other packages with problems could block the installation. For example I had issues with libgomp1 where it had a spurious dependency. I actually hacked /var/lib/dpkg/status with a text editor to bypass this.
What made this exercise worthwhile
When I use mplayer on the RPi to record an Internet radio station I was surprised to find that it didn't eat up 100% of a core like on my workstation. So I ran a strace on mplayer on my workstation and saw that it was looping on reading file descriptor 0 (stdin). Recalling that mplayer reads single keystrokes from the controlling terminal to control the playback, I reasoned that it must be doing that in non-interactive mode and looping on failure. So I found the -noconsolecontrols and -slave options to mplayer and adding these to the command made the CPU usage normal again.