Thursday, December 19, 2019

Ubuntu and the Logitech Media Server on the Raspberry Pi 4

Ubuntu 

Update

I have discontinued the use of LMS and have switched to Roon. The parts list for going that route are identical, but while you can run LMS and the streamer on the Raspberry Pi, Roon will only run the streamer on the Pi due to performance requirements, so if you have an old laptop or PC to use as the Roon core, read below to see the parts you need for the streamer.

Parts

I used a Pi 4 with 4 GBytes of RAM and 128 GB Micro SD card for the OS. I used a separate USB thumb drive for the music storage. 

I installed Ubuntu server 19.10.1 by following these instructions. 

Pretty much ignore any extra package installations though. Some of the linked pages are for pre 19.10 and they are not needed.

 Here is the list of parts, which if all purchased add up to under $150.  A lot cheaper than a $3,000 streamer! :


I say the HDMI adapters are optional because once the system boots, you'll have SSH access, so if you are comfortable remoting into a Linux server and you don't mind waiting 20 minutes or so the first time, just hook the Pi up to your Ethernet and power and walk away.  Then go find the new IP address in your home router.

Otherwise, hook up the HDMI before you power it on, add a keyboard and mouse you have in the closet and you are good to go. 

Protip: When you flash the Micro SD card, connect directly to your PC! I used a USB 2.0 hub and I kept getting errors during the flash process using a variety of image flashing tools. As soon as I connected directly to the back of my PC this all went away.

Protip: The absolute smallest Micro SD card I'd recommend for Ubuntu is 32 GB.  Ubuntu recommends 25 GB of disk space, so this is the smallest SD card which meets those requirements.  If you absolutely know you'll never install a desktop you might go smaller, but these things are so cheap it doesn't make sense. Also, while I do think that the 128 GB or larger Micro SD is ideal for the OS/boot drive I keep my music on a separate USB device. This has made migrating from the Pi 3 to the 4 super easy. I basically just flashed a new Micro SD card, and moved all of my music over with the plugging in of a thumb drive. Much, much faster than copying.

For instance, if you aren't used to using VI or EMACS you are probably going to want to install a GUI so you can get a graphical text editor working, so go ahead and spend the extra few dollars for the boot drive. :) 

The same idea applies if you want to experiment with any of the other music OS type of packages like Daphile, PiCore or Volumio. 

Logitech Media Server

The general instructions are here:

http://wiki.slimdevices.com/index.php/Debian_Package#installing_7.9.2

There's one tiny bit of code to change to the script. Where it says:

if [ "$os" = "armhf" ]; then os=arm; fi
 
Replace "armhf" with "arm64", like so:
 
if [ "$os" = "arm64" ]; then os=arm; fi 

That's pretty much it!  The entire installation was remarkably pain free otherwise.

Squeezelite

In the past I recommended building 1.9 or grabbing a copy from my repo on SourceForge. However this is no longer necessary as the version from the Ubuntu repo has direct DSD playback built in.  So install from the repo:

sudo apt install squeezelite

and modify /etc/default/squeezelite per my prior blog post.

Protip: 
You won't see any sound cards show up until you hook up a USB DAC. There ARE ways to get sound to play via HDMI and the 1/8" jack, but they are covered elsewhere. If you are using a USB DAC (and you should) then go ahead and plug it in. You may need to restart your Pi for it to do the USB scanning. At least with Ubuntu 16, USB audio devices had to be present at boot time for them to be seen.

The Pi 4 comes with USB 2.0 (black) and USB 3.0 (blue). This means that all plugs are capable of handling the bandwidth for even quad DSD. However, you might want to keep storage on one side (black) and leave the blue for the DAC. The main reason here is that depending on how the controllers are set up, you can reduce contention and prevent one device from slowing down others. Perhaps I'm being paranoid. :)

No comments:

Post a Comment