Logitech's server software for their Slimdevices Squeezebox product line has gone through many names: slimserver, squeezeboxserver, logitechmediaserver, Lyrion, etc. Over the years it has been painful to upgrade FreeBSD because of the "dependency hell" induced by this program's packaging of Perl libraries. I used to be able to build it from ports, and more recently I used packages, but the software is very sensitive to the version of Perl you have installed. Changing the Perl version is fraught with peril:
Forums are littered with NAS users trying to build it themselves in complicated jails, and until now I never had any luck developing a clean, consistent method for building it. At one point I was using a custom repository from an Italian gent, but even that posed problems during major OS upgrades. His article gave me clues to developing a process to build it successfully from source as needed. I can now upgrade my OS without worries.
wget https://downloads.lms-community.org/nightly/lyrionmusicserver-9.0.0-1713442161-noCPAN.tgz wget https://github.com/Logitech/slimserver-vendor/archive/public/9.0.zip
unzip 9.0.zip cd slimserver-vendor-public-9.0/CPAN ./buildme.sh -t | tee /tmp/build.log
There was a comment in a blog that mentions building your own custom version of perl, but I don't think it's worth the trouble. If this build of LMS ever breaks after an OS upgrade, I'll just rebuild it quickly from source.
My version of perl happened to be 5.36. You may have to create this directory under CPAN/arch. I chose to remove all the other subdirectories under arch/ for unused versions of perl.
cd lyrionmusicserver-9.0.0-1713442161-noCPAN/CPAN/arch cp -Rp ../../../slimserver-vendor-public-9.0/CPAN/build/arch/5.36 .
cp -Rp lyrionmusicserver-9.0.0-1713442161-noCPAN /usr/local/lms/
This makes slimserv.pl, scanner.pl, etc. use the system-wide perl. I couldn't get FreeBSD's rc.subr(8) command_interpreter to handle this the way I wanted it to, so I ended up modifying them myself.
cd /usr/local/lms/ perl -p -i -e 's,^#\!/usr/bin/perl,#\!/usr/bin/env perl,' *.pl
Verify everything works by running slimserver in the foreground (without --daemon). I based the following command on FreeBSD's rc script; your mileage may vary.
/usr/local/bin/perl /usr/local/lms/slimserver.pl --pidfile=/var/run/logitechmediaserver/logitechmediaserver.pid \ --user=slimserv --group=slimserv --logdir=/var/log/logitechmediaserver --cachedir=/var/db/logitechmediaserver/cache \ --prefsdir=/var/db/logitechmediaserver/prefs --playlistdir=/var/db/logitechmediaserver/playlists
Since I already had a previous port of LMS on my machine, the user/group slimserv:slimserv and appropriate directories were already created. All I had to do was edit an existing copy of the startup script. Here are the tweaks I made.
diff --git a/rc.d/logitechmediaserver b/rc.d/logitechmediaserver
index 608353d..65e6cd8 100755
--- a/rc.d/logitechmediaserver
+++ b/rc.d/logitechmediaserver
@@ -20,7 +20,9 @@ start_precmd="logitechmediaserver_start_precmd"
stop_postcmd="logitechmediaserver_stop_postcmd"
rcvar=logitechmediaserver_enable
-command=/usr/local/share/logitechmediaserver/slimserver.pl
+#command=/usr/local/share/logitechmediaserver/slimserver.pl
+command=/usr/local/lms/slimserver.pl
command_interpreter=/usr/local/bin/perl
pidfile=/var/run/${name}/${name}.pid
logdir=/var/log/${name}
@@ -30,7 +32,9 @@ prefsdir=${statedir}/prefs
playlistdir=${statedir}/playlists
u=slimserv
g=slimserv
-command_args="--daemon --pidfile=${pidfile} --user=${u} --group=${g}"
+#command_args="--daemon --pidfile=${pidfile} --user=${u} --group=${g}"
+command_args="--daemon --pidfile=${pidfile} --user=${u} --group=${g} --logdir=${logdir} --statedir=${statedir} --cachedir=${cachedir} --prefsdir=${prefsdir} --playlistdir={$playlistdir}"
logitechmediaserver_user=${u}
logitechmediaserver_group=${g}
If it fails to start at boot time, ensure the startup script's $PATH contains perl. FreeBSD 14.1 exhibits different
behavior than previous versions where you have to explicity set $PATH.
export PATH="${PATH}:/usr/local/bin"