Pages

Thursday, April 5, 2018

Maintaining the Raspberry Pi Squeezebox server (aka Logitech Media Server)

Introduction

I wrote earlier about the Logitech Media Server (LMS), open source software that I've used to turn a Raspberry Pi into a music server for my Squeezebox devices. I'm using my Raspberry Pi based Logitech Media Server a couple of months and I've grown very fond of it. What started as an experiment now has become a device I'm starting to rely on. I guess that eventually I have to replace it with something like the WD PiDrive Node Zero. In the meantime however I do need to maintain the LMS. In this blogpost I'll explain how I add and remove music files from the LMS and create a simple backup of your music files. Finally I provide a tip to debug problems with the Logitech Media Server. All software that I used for this project is free and open source.

My Raspberry Pi turned into an LMS with 3D printed case on my desk.

Adding, changing and deleting music files

I partly ripped my CD collection and still add new albums. All the ripping is done on my Thinkpad T40 laptop using Asunder, a low resource ripper for Linux, on the Puppy Linux operating system. In the beginning I unmounted the USB hard disk from the LMS, removed it and connected it to the laptop and copied the new albums. This proved to be be a clumsy method and I quickly found myself looking for an alternative.

I decided to use FTP to transfer files over the network to the Raspberry Pi. FTP is a network protocol to transfer files between a client and a server. The software that I'm using is either FileZilla or gFTP. They have basically the same functionality but gFTP is not available for Windows while FileZilla is available for GNU/Linux, OSX and Windows. Working with both is easy enough the only problem that I had was to set the ownership for the USB hard disk on the Raspberry Pi. Only root was able to write to the disk. The reason is a bit technical and maybe confusing but I had used the Windows FAT filesystem for the USB hard disk and when I mounted it on my Linux laptop (Puppy Linux distro), ownership of all files was changed by Puppy Linux to root. At this point it was impossible to change ownership and permissions with chmod and chown from the media server. To solve this problem I had to unmount and mount the USB hard disk using the following general command:
mount device mount-point -o uid=foo -o gid=foo
or in my case
mount  /dev/sda1 /media/usb-drive -o uid=pi -o gid=pi
This command sets the ownership of all files on the USB hard disk to pi instead of root enabling me to use FileZilla and gFTP.

Creating a backup of the music collection

I invested a lot of time in ripping my CD collection so it would be a shame if I lost my music files due to a hard disk crash. I therefore use a very simple backup method, largely copied from the Raspberrypi.org website to ensure that my files are safe.
cd /home/media/usb-drive
sudo tar czf usbdrive.tar.gz
This creates a file 'usbdrive.tar.gz' that contains files in /media/usb-drive, the mounting point of my USB drive and places it in the same map. Next I use (again) Filezilla to move the backup file to my desktop computer.

Debug problems with the Logitech Media Server (tip)

I didn't encounter much problems with the LMS but if you do take a look into the log file of the server. This can be done opening a terminal on your PC and login into the Rasperry Pi with:
ssh pi@<your_network_ip_address_of_the_server>
cat /var/log/squeezeboxserver/server.log
The sudo ssh command prompts for the password of the Raspberry Pi.  Now look for anything suspicious in the log, copy it and do an internet search with your preferred search engine. Chances are someone already encountered the same problem.

Earlier posts about the Logitech Media Server:

Setting up a Raspberry Pi Logitech Media Server
https://eribuijs.blogspot.nl/2017/08/creating-raspberry-pi-squeezebox-server.html

3d printed enclosure for the Raspberry Pi Logitech Media Server
https://eribuijs.blogspot.nl/2017/11/raspberry-pi-squeezebox-server-with-3d.html

No comments:

Post a Comment