Back in early 2014, I purchased my first ARM-based computer, a SolidRun CuBox-i4. My goal for the CuBox was to have a headless device (e.g., no display) that takes up minimal space in the audio equipment shelf, makes minimal noise, and serves music files to my digital-to-analog converter (DAC) and thus to the rest of the stereo. On paper, the CuBox was a perfect fit. It is fanless, works with various Linux distros, provides a separate eSATA interface for a locally mounted hard drive and therefore leaves the USB ports free for other stuff, provides a TOSLINK port for digital audio, uses a MicroSD card (by default, anyway) for the system installation and boot drive, and comes with 2GB of RAM and a reasonably fast i.MX6q quad-core processor, all in an unobtrusive 5x5x5cm black plastic box.
And as luck would (sometimes) have it, those promises have mostly been kept. The box still runs and provides my family with a great deal of musical enjoyment. The attached hard drive contains about 275GB of music files—a bit over 7,500 FLAC files with some 300 or so MP3 files thrown in.
As our home music server, the CuBox runs a barebones Linux server distro with Music Player Daemon (MPD) as the music-serving software, sending digital data to the DAC via the ALSA with no software mixing, up- or down-sampling, or volume control on the server. Lately, I've found it convenient to run lighttpd, a lightweight, simple-to-configure HTTP server, to provide cover images to the various MPD clients that we run in the house. (But now MPD provides that capability, so that convenience may soon go away.) For the user interfaces to play music, we use Cantata on the desktop and MPD Remote (caution: it may not be open source) on our Android phones to browse, select, and play music.
In 2017, I wrote about my experiences using the CuBox. I had tried Voyage Linux, Volumio, and Archphile Linux, and had just moved to Armbian, which at that time was based on Ubuntu 16.04 LTS (long term support). This fall, I decided it was time to upgrade the server, get the latest version of MPD, and deal with a few other bothersome details along the way.
Given my generally great experience with Armbian, I decided to go there again for upgrade materials. There are two supported options: a Debian Buster-based server configuration and an Ubuntu 18.04 desktop configuration. Bearing in mind my desire to keep the system display-free and minimalist, I selected the Debian version.
The download was trouble-free, and I soon had an install image in my Downloads folder. As before, I was impressed with the quality and "to the point" nature of the Armbian documentation, which notes:
Images shall only be written with Etcher on all platforms since, unlike other tools, Etcher validates burning results saving you from corrupted SD card contents.
This was my first experience using Etcher, and I was duly impressed with its usability (yet another wonderful reason to use open source software). I inserted the resulting MicroSD card into the CuBox, connected the Ethernet cable, DAC, and eSATA drive, and powered it on. Soon, I could SSH into the CuBox to configure it. Talk about a painless experience! Here's what I see when I log into that machine using SSH:
In terms of configuration, I had the following objectives:
- Finish the initial configuration
- Configure static IP addressing for the wired networking connection
- Get the installed system up to date
- Disable the wireless
- Install and configure MPD
- Install and configure lighttpd
- Listen to some music!
I used the excellent Armbian Config program to carry out a bunch of these initial configuration tasks.
Choosing System presents this menu:
I used this to disable root login over SSH and enable password and public key authentication.
In the Network subsystem, I set static IP addressing (to conform to my home router settings), and in the Personal subsystem, I changed the time zone and hostname. I probably could have used the Software subsystem to run the initial update, but I chose to exit to the shell and use apt to finish up this initial configuration with:
sudo apt update
sudo apt upgrade
I also used apt to install MPD and lighttpd with:
sudo apt install mpd lighttpd
I had my previous MPD configuration file (/etc/mpd.conf); generally, I prefer to use these types of older files as guides to configure a new one, rather than just plunking the old one on top of the new. In the end, there weren't many changes to make; here are the differences between the old and new files:
clh@stereo:/etc$ diff mpd.conf.orig mpd.conf
< bind_to_address "localhost"
> #bind_to_address "localhost"
> bind_to_address "192.168.1.21"
< name "My ALSA Device"
> name "Drop Airist R2R"
> device "hw:CARD=U20,DEV=0"
> mixer_type "none"
> replay_gain_handler "none"
> # name "Schit Bifrost 4490"
> # device "hw:CARD=S2,DEV=0"
> # mixer_type "none"
> # replay_gain_handler "none"
You can see that I have two DACs (just because), and the second is commented out (and not connected). Also, I had to change bind_to_address so that MPD will listen over the local area network.
As for lighttpd, I only had to change the document-root:
clh@stereo:/etc/lighttpd$ diff lighttpd.conf.orig lighttpd.conf
< server.document-root = "/var/www/html"
> # Used this config documentation
> # which wasn't good - wrong user name, didn't need to add
> # the mime config
> # in the end just changed the document root.
> server.document-root = "/var/lib/mpd/music/"
To get to the music files, I added the following line to /etc/fstab:
/dev/sda1 /mnt/eSATA ext4 rw 0 0
and created the mount point with:
sudo mkdir /mnt/eSATA
At this point, I mounted the external hard drive with:
sudo mount /dev/sda1
Finally, I linked MPD's configuration directory to the music with:
sudo rmdir /var/lib/mpd/music
sudo ln -s /mnt/eSATA/Music /var/lib/mpd/music
I used this approach because I'd rather not futz around with MPD's configuration more than I have to.
It's a good idea to check that the music files are owned by the correct MPD user ID. Do this with:
clh@stereo:~$ ls -ld /var/lib/mpd/music/* | head
drwxrwxrwx 5 mpd audio 4096 Jan 22 2017 /var/lib/mpd/music/Academy of St. Martin-in-the-Fields
drwxrwxrwx 3 mpd audio 4096 Jan 22 2017 /var/lib/mpd/music/Acantus
drwxrwxrwx 3 mpd audio 4096 Dec 13 2014 /var/lib/mpd/music/Afrikan_Sciences
drwxrwxrwx 5 mpd audio 4096 Sep 25 2016 /var/lib/mpd/music/Afro Celt Sound System
drwxrwxrwx 3 mpd audio 4096 Mar 11 2014 /var/lib/mpd/music/Agnes Obel
drwxrwxrwx 3 mpd audio 4096 Oct 9 2013 /var/lib/mpd/music/Alexander Malter, Dietmar Schwalke, Vladimir Spiakov, Sergej Bezrodny
drwxrwxrwx 3 mpd audio 4096 Oct 8 2013 /var/lib/mpd/music/Ali Farka Toure & Toumani Diabate
drwxrwxrwx 3 mpd audio 4096 Oct 8 2013 /var/lib/mpd/music/Ali Farka Touré with Ry Cooder
drwxrwxrwx 5 mpd audio 4096 Jan 1 2018 /var/lib/mpd/music/Amadou et Mariam
drwxrwxrwx 3 mpd audio 4096 Jul 11 2017 /var/lib/mpd/music/American Authors
This looks fine (user ID mpd, group ID audio).
Finally, to disable the wireless, I entered:
sudo nmcli radio wifi off
And I'm done! Time for a reboot:
sudo systemctl reboot
Once it rebooted, I used Cantata to force MPD to refresh its database. Here's what it looks like when that's done, and I'm listening to Frameworks' latest album, Imagine Gold:
Just to the left of the track listings, you can see the cover images that lighttpd serves.
And speaking of music
I really do like Frameworks' latest album. It's quite similar to his previous work, and he always has the greatest hooks with very dance-able stuff and just that great bit of "yearning." It's nice to buy his stuff on Bandcamp, as usual (see link above, where you can also listen).
Lately, I've also been buying stuff in that other great open source format, vinyl records. In particular, two fine recent albums from the Erased Tapes label, Anne Müller's Heliopause, which is a beautiful record of her own solo cello and supporting instruments and sounds, "focusing on novel approaches to classical instrumentation," and Penguin Cafe's Handfuls of Night, which "began life after Greenpeace commissioned [Arthur] Jeffes [of Penguin Cafe] to write four pieces of music corresponding to four breeds of penguins to help raise awareness for the endangered Antarctic seas." How could a Linux user not have music about penguins by Penguin Cafe?