LogitechMediaServer (LMS) on FreeNAS

alwu

Dabbler
Joined
Jan 24, 2018
Messages
36
i finally upgraded from 11.1-U6 to 11.2-U7. i tried installing LMS using the steps i listed before, hoping that everything was fixed and it would just work. no such luck. i also encountered the same file access error messages that others saw. changing the perl version to 5.28 helped to get LMS to install correctly. thanks @willcycle, @KrisBee , and @cbv for figuring everything out. so in addition to the install methods that @cbv and @SimoneF metnioned, here's how i got LMS to install.
  1. created a an iocage jail via the web gui.
    • enabled auto-start(optional) and vnet.
    • selected the 11.3 release for compatibility with the pkg tools.
  2. added mount points for my music.
  3. started the jail.
  4. the following commands can be executed in a jail shell via the web gui or ssh.
    1. pkg update
    2. pkg upgrade
    3. pkg install portmaster
    4. portsnap fetch extract
    5. echo "DEFAULT_VERSIONS=perl5=5.28" > /etc/make.conf
    6. portmaster audio/logitechmediaserver
    7. selected flac and lame support on the first screen and disabled tests. kept the defaults for the remaining screens.
    8. at the last prompt before everything got compiled, there was a list of everything that was going to get installed. i verified that lang/perl5.28 was going to be installed.
    9. the install paused a few times with a prompt about whether or not to keep gettext-1.07.tar.gz. i hit return to use the default value of no.
    10. after the install finished:
      1. sysrc logitechmediaserver_enable="YES"
      2. service logitechmediaserver start
 

Erik.s

Cadet
Joined
Oct 10, 2015
Messages
1
Hi!
I'm the owner of audiodigitale.eu
I made and installer script to install easily lms, I've compiled it from 2433703 commit (7.9.2 version)
I've tested it only on Freebsd-12 but I need some feedback if it has some bugs on other bsd versions.
Before proceeding if lms is already installed it's better to delete it (optional) and to delete related lines on rc.conf
Logitechmediaserver and FreeBSD

Thanks
Yesterday I found SimoneF's website and used his installer following his instructions and it was quick and easy and works perfectly.
I was running Freenas 11.2 u7 when I did the install, but I upgraded to 11.3 today and LMS is still running fine.
 

SimoneF

Explorer
Joined
Feb 9, 2019
Messages
59
Yesterday I found SimoneF's website and used his installer following his instructions and it was quick and easy and works perfectly.
I was running Freenas 11.2 u7 when I did the install, but I upgraded to 11.3 today and LMS is still running fine.
Thanks for the feedback, really appreciated :D
 

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
I was and am a big fan of Daphile, which is based on LMS, but it requires a separate, dedicated x86 box. LMS running in a FreeNAS jail is, to me, the best audio streaming system available. No extra hardware, RPis as players, full admin from a web browser and full control by a phone app; who needs Sonos or the others when the RPi DACs can run at 24 bit/384kHz (not that I bother with that audiophool nonsense) and are such good quality audio output.

A big thank you for all who have provided such a useful resource.
 

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
@SimoneF,
In another thread (one I created - LMS 7.9.2 install in 11.2), I advised people to use your installer.
I would also acknowledge, in this thread, your contribution to a fantastic resource. Thank you for making LMS work and making it so easy. FYI, I selected version 8.0.0 and it is playing one of my favourite bands, Boy & Bear,'s latest album, right now. Another of my favourites bands is Holy Holy (no religious influence whatsoever), another Australian group, which deserves broader recognition because of great lyrics and music, though the last album is a bit over-produced.
 

trommegutten

Cadet
Joined
Mar 29, 2020
Messages
8
i finally upgraded from 11.1-U6 to 11.2-U7. i tried installing LMS using the steps i listed before, hoping that everything was fixed and it would just work. no such luck. i also encountered the same file access error messages that others saw. changing the perl version to 5.28 helped to get LMS to install correctly. thanks @willcycle, @KrisBee , and @cbv for figuring everything out. so in addition to the install methods that @cbv and @SimoneF metnioned, here's how i got LMS to install.
  1. created a an iocage jail via the web gui.
    • enabled auto-start(optional) and vnet.
    • selected the 11.3 release for compatibility with the pkg tools.
  2. added mount points for my music.
  3. started the jail.
  4. the following commands can be executed in a jail shell via the web gui or ssh.
    1. pkg update
    2. pkg upgrade
    3. pkg install portmaster
    4. portsnap fetch extract
    5. echo "DEFAULT_VERSIONS=perl5=5.28" > /etc/make.conf
    6. portmaster audio/logitechmediaserver
    7. selected flac and lame support on the first screen and disabled tests. kept the defaults for the remaining screens.
    8. at the last prompt before everything got compiled, there was a list of everything that was going to get installed. i verified that lang/perl5.28 was going to be installed.
    9. the install paused a few times with a prompt about whether or not to keep gettext-1.07.tar.gz. i hit return to use the default value of no.
    10. after the install finished:
      1. sysrc logitechmediaserver_enable="YES"
      2. service logitechmediaserver start
Between step 5 and 6 I think I had to install perl5.28
Code:
root@lms:~ #portmaster lang/perl5.28
 

SimoneF

Explorer
Joined
Feb 9, 2019
Messages
59
@SimoneF,
In another thread (one I created - LMS 7.9.2 install in 11.2), I advised people to use your installer.
I would also acknowledge, in this thread, your contribution to a fantastic resource. Thank you for making LMS work and making it so easy. FYI, I selected version 8.0.0 and it is playing one of my favourite bands, Boy & Bear,'s latest album, right now. Another of my favourites bands is Holy Holy (no religious influence whatsoever), another Australian group, which deserves broader recognition because of great lyrics and music, though the last album is a bit over-produced.

Thanks a lot! I really appreciate your words!

New update for version 8.0.0. If anyone is using it start lms_installer and then Check updates
 

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
New update for version 8.0.0. If anyone is using it start lms_installer and then Check updates
Done and works perfectly.
 

zephyr

Dabbler
Joined
Aug 29, 2013
Messages
14
When I try to install LMS with @SimoneF lms_installer in FreeNAS 11.3 jail I get /usr/local/bin/lms_installer: 1: Syntax error: newline unexpected (expecting word) message. Where should I look for the solution?
 

zephyr

Dabbler
Joined
Aug 29, 2013
Messages
14
After downloading new version of lms_installer message is still the same. Nothing has changed.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Hello @SimoneF, thank you! This was the easiest LMS install yet. I did run into an issue, which was easily fixed.
TrueNAS Core 12.0 Beta 1, chose to install LMS 8.0.0.
After install, logitechmediaserver service would not start, error message below.
Going into every .pl file in /usr/local/share/logitechmediaserver and changing the shebang from /usr/bin/perl to /usr/bin/env perl fixed the issue.

Code:
root@LMS-audiodigitale:~ # service logitechmediaserver start
Starting logitechmediaserver.
sh: /usr/local/share/logitechmediaserver/slimserver.pl: not found
/usr/local/etc/rc.d/logitechmediaserver: WARNING: failed to start logitechmediaserver
root@LMS-audiodigitale:~ # ls /usr/local/share/logitechmediaserver/
.editorconfig           custom-convert.conf     icudt46b.dat            modules.conf            SOCKS.txt
Bin                     Firmware                icudt46l.dat            MySQL                   SQL
cleanup.pl              gdresize.pl             icudt58b.dat            revision.txt            strings.txt
convert.conf            gdresized.pl            icudt58l.dat            scanner.pl              types.conf
convert.conf.sample     Graphics                IR                      Slim                    types.conf.sample
CPAN                    HTML                    lib                     slimserver.pl

root@LMS-audiodigitale:/usr/local/share/logitechmediaserver # ls -R *pl
cleanup.pl      gdresize.pl     gdresized.pl    scanner.pl      slimserver.pl

#!/usr/bin/env perl

root@LMS-audiodigitale:/usr/local/share/logitechmediaserver # service logitechmediaserver start
Starting logitechmediaserver.
[20-07-12 00:44:17.5327] main::init (388) Starting Logitech Media Server (v8.0.0, 1591161678, audiodigitale.eu 07-06-2020) perl 5.030003 - amd64-freebsd-thread-multi
 

SimoneF

Explorer
Joined
Feb 9, 2019
Messages
59
Hello @SimoneF, thank you! This was the easiest LMS install yet. I did run into an issue, which was easily fixed.
TrueNAS Core 12.0 Beta 1, chose to install LMS 8.0.0.
After install, logitechmediaserver service would not start, error message below.
Going into every .pl file in /usr/local/share/logitechmediaserver and changing the shebang from /usr/bin/perl to /usr/bin/env perl fixed the issue.

Code:
root@LMS-audiodigitale:~ # service logitechmediaserver start
Starting logitechmediaserver.
sh: /usr/local/share/logitechmediaserver/slimserver.pl: not found
/usr/local/etc/rc.d/logitechmediaserver: WARNING: failed to start logitechmediaserver
root@LMS-audiodigitale:~ # ls /usr/local/share/logitechmediaserver/
.editorconfig           custom-convert.conf     icudt46b.dat            modules.conf            SOCKS.txt
Bin                     Firmware                icudt46l.dat            MySQL                   SQL
cleanup.pl              gdresize.pl             icudt58b.dat            revision.txt            strings.txt
convert.conf            gdresized.pl            icudt58l.dat            scanner.pl              types.conf
convert.conf.sample     Graphics                IR                      Slim                    types.conf.sample
CPAN                    HTML                    lib                     slimserver.pl

root@LMS-audiodigitale:/usr/local/share/logitechmediaserver # ls -R *pl
cleanup.pl      gdresize.pl     gdresized.pl    scanner.pl      slimserver.pl

#!/usr/bin/env perl

root@LMS-audiodigitale:/usr/local/share/logitechmediaserver # service logitechmediaserver start
Starting logitechmediaserver.
[20-07-12 00:44:17.5327] main::init (388) Starting Logitech Media Server (v8.0.0, 1591161678, audiodigitale.eu 07-06-2020) perl 5.030003 - amd64-freebsd-thread-multi

Hi Yorick,
Haven't really tested yet the new TrueNAS Core, so bug were expected :/
Can I ask you some info to better debug the problem and update the installer with a fix?

1- Can you past here the result of "uname -a"?
2- Did you create the jail as a clone jail or as a base jail?

It seems that to properly solve this problem I have to try to install TrueNAS Core on a VM because it seems it can't find perl where it is supposed to be so the trick is to use the enviroment path of perl; Just for curiosity I need to understand WHY it doesn't find perl, in the next days I'll dig into this problem
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
1- Can you past here the result of "uname -a"?
2- Did you create the jail as a clone jail or as a base jail?

Base jail. I’ll get a uname -a in a bit.

Perl is in /usr/local/bin which is where it is supposed to be as far as I know. /usr/bin is an older path the the perl pkg suggests not to use.

I used /usr/bin/env perl because that is the "portable" suggestion, but that confused rc.d, so I went for /usr/local/bin/perl instead. With the exception of cleanup.pl, which comes with #!/usr/bin/env perl -ICPAN out of the box, I didn't touch that.

Code:
root@LMS-audiodigitale:~ # uname -a
FreeBSD LMS-audiodigitale 12.1-STABLE FreeBSD 12.1-STABLE 3ef17902a90(HEAD) TRUENAS  amd64
root@LMS-audiodigitale:~ # freebsd-version
12.1-RELEASE-p7
 
Last edited:

SimoneF

Explorer
Joined
Feb 9, 2019
Messages
59
Base jail. I’ll get a uname -a in a bit.

Perl is in /usr/local/bin which is where it is supposed to be as far as I know. /usr/bin is an older path the the perl pkg suggests not to use.

I used /usr/bin/env perl because that is the "portable" suggestion, but that confused rc.d, so I went for /usr/local/bin/perl instead. With the exception of cleanup.pl, which comes with #!/usr/bin/env perl -ICPAN out of the box, I didn't touch that.

Code:
root@LMS-audiodigitale:~ # uname -a
FreeBSD LMS-audiodigitale 12.1-STABLE FreeBSD 12.1-STABLE 3ef17902a90(HEAD) TRUENAS  amd64
root@LMS-audiodigitale:~ # freebsd-version
12.1-RELEASE-p7

Can you try with a clone Jail?
I bet there won't be this problem (hopefully)
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
I'll try!

Separate issue: The PID recorded seems wrong / off, and so the service gets started but status or stop won't work.


Code:
root@LMS-audiodigitale:~ # ps -ax
  PID TT  STAT    TIME COMMAND
85809  -  IsJ  0:00.00 /usr/sbin/rtsold -a
85869  -  SsJ  0:00.00 /usr/sbin/syslogd -c -ss
85545  0  I+J  0:00.01 /bin/sh /etc/rc
85919  0  I+J  0:00.00 /bin/sh /etc/rc
85930  0  I+J  0:00.00 su -m slimserv -c sh -c "/usr/local/share/logitechmediaserver/slimserver.pl  --daemon --pidfile=
85931  0  IJ   0:00.00 _su -m -c sh -c "/usr/local/share/logitechmediaserver/slimserver.pl  --daemon --pidfile=/var/run
85933  0  DJ   0:00.11 /usr/local/bin/perl /usr/local/share/logitechmediaserver/slimserver.pl --daemon --pidfile=/var/r
86128  1  SJ   0:00.00 login [pam] (login)
86129  1  SJ   0:00.01 -csh (csh)
86134  1  R+J  0:00.00 ps -ax
root@LMS-audiodigitale:~ # service logitechmediaserver status
logitechmediaserver is not running.
root@LMS-audiodigitale:~ # service logitechmediaserver stop
logitechmediaserver not running? (check /var/run/logitechmediaserver/logitechmediaserver.pid).
root@LMS-audiodigitale:~ # cat /var/run/logitechmediaserver/logitechmediaserver.pid
86174
root@LMS-audiodigitale:~ #
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
That's unexpected to me - clone jail has perl in /usr/bin, not /usr/local/bin. Maybe /usr/bin/env is the only way to get this work in both clone and base jails.

Edited: Okay got it. You are creating a symlink in /usr/bin, aren't you? That won't work in a base jail, and see below for what the perl package has to say about it.

This is what a clone jail with just perl5 shows:

Code:
root@Clone-Test:~ # which perl
/usr/local/bin/perl


PID issue also gone in a clone jail, this may be a matter of trying to write where a base jail won't let you, as well.

Code:
root@LMS-clone:~ # service logitechmediaserver start
Starting logitechmediaserver.
[20-07-12 17:07:32.2285] main::init (388) Starting Logitech Media Server (v8.0.0, 1591161678, audiodigitale.eu 07-06-2020) perl 5.030003 - amd64-freebsd-thread-multi
root@LMS-clone:~ # service logitechmediaserver status
/usr/local/etc/rc.d/logitechmediaserver: WARNING: $command_interpreter /usr/local/bin/perl != /usr/bin/perl
logitechmediaserver is running as pid 14660.
root@LMS-clone:~ #



The perl pkg has this to say:

Code:
Message from perl5-5.30.3:

--
The /usr/bin/perl symlink has been removed starting with Perl 5.20.
For shebangs, you should either use:

#!/usr/local/bin/perl

or

#!/usr/bin/env perl

The first one will only work if you have a /usr/local/bin/perl,
the second will work as long as perl is in PATH.
 
Last edited:

SimoneF

Explorer
Joined
Feb 9, 2019
Messages
59
That's unexpected to me - clone jail has perl in /usr/bin, not /usr/local/bin. Maybe /usr/bin/env is the only way to get this work in both clone and base jails.

Edited: Okay got it. You are creating a symlink in /usr/bin, aren't you? That won't work in a base jail, and see below for what the perl package has to say about it.

This is what a clone jail with just perl5 shows:

Code:
root@Clone-Test:~ # which perl
/usr/local/bin/perl


PID issue also gone in a clone jail, this may be a matter of trying to write where a base jail won't let you, as well.

Code:
root@LMS-clone:~ # service logitechmediaserver start
Starting logitechmediaserver.
[20-07-12 17:07:32.2285] main::init (388) Starting Logitech Media Server (v8.0.0, 1591161678, audiodigitale.eu 07-06-2020) perl 5.030003 - amd64-freebsd-thread-multi
root@LMS-clone:~ # service logitechmediaserver status
/usr/local/etc/rc.d/logitechmediaserver: WARNING: $command_interpreter /usr/local/bin/perl != /usr/bin/perl
logitechmediaserver is running as pid 14660.
root@LMS-clone:~ #



The perl pkg has this to say:

Code:
Message from perl5-5.30.3:

--
The /usr/bin/perl symlink has been removed starting with Perl 5.20.
For shebangs, you should either use:

#!/usr/local/bin/perl

or

#!/usr/bin/env perl

The first one will only work if you have a /usr/local/bin/perl,
the second will work as long as perl is in PATH.

Hi Yorik,
I leave here another thread where it's explained the differences betweek every type of jail:

Now, reading that you might guess why everything seems working on a clone jail and not on a base jail. (and yes I'm using a symlink, which is a very bad way to make things working, but when I have first written the code I just wanted to "do the work" for myself, and way before perl 5.20, but now that's public and I have to rewrite some parts in a more "decent" way)
And that's mainly my fault,
I don't use freenas as a "production" server/nas, I usually use plain FreeBSD. I have FreeNAS in a VM just for some quick testing before releasing any update of the installer, and when I test I use clone jails just to be fast.
Beside that, in my opinion, Clone Jails are just bad. Really, I can't see any advantages over using them other that hard disk space; but we are not in early 2000s, HDD are cheap and space is no more a problem. In production I uses jails that are comparable as iocage ThickJails, in other words a fully independent system (in freeNAS you don't have this options in GUI, only with command line).
Having said that, I avoided until now using /usr/bin/env perl because, while it is the most smart way to make LMS really portable, it can cause issues if you don't install it in a jail but in the host and there are multiple versions of perl installed.

So, for the moment I suggest anyone to just use a Clone Jail, and in these days I'll modify the installer to not have any more issues with every kind of jail you are installing it into. It is not hard nor a long work, but I just have not a lot of free time, so be patient :D

BTW, thanks a lot for raising this problem a diggin into it.
It will be fixed!

Cheers,
Simone
 
Last edited:

SimoneF

Explorer
Joined
Feb 9, 2019
Messages
59
@Yorick
Just released an update. Everything is working for both clone and base jails.
Directly on the host there is the PID problem. I'll into it in the next days.
EDIT: no more pid problem too
 
Last edited:
Top