Logitech Media Server for FreeNAS 9.2.1.1

Status
Not open for further replies.
Joined
Jan 19, 2015
Messages
10
Hello,

I tried out things with FreeNAS 9.3-stable and got things working. There's a couple of gotchas that I don't think have been highlighted yet. So, in the hopes of helping out others, I thought I would post my experience to save a couple hours for someone (I hope).

Using the script from djoole gets you almost all the way, but the version of the modules that are installed via pkg on 9.3-stable are for Perl 5.18 (not 5.16). However, the version of Perl that is installed in the jail is 5.16. So, you have module mismatch and LMS won't start. No, problem right? run "pkg update" to update Perl. This gets rid of the one of the module mismatches.

Where's the second mismatch? LMS will run, but its scanning willl fall down and you'll have an empty (or almost empty) library, but it will happily play any file if you walk through its Music Folder. Turns out the Scan.so that was provided djoole is compiled for Perl 5.16 (which makes sense as that was what the script was originally targetted against); it won't work with 5.18 (wrong Magic number or something). So, now audio scanning doesn't work.

The Scan.so is for the AudioScan module that is part of the "vendor modules" for LMS. You can build these yourself by cloning the repo from github. Change to the "CPAN" directory and there's a a build script (buildme.sh) for building all of these modules (the link I gave is for the 7.8-branch, which is what djoole's script uses). At a quick glance, I couldn't find a way to only build the AudioScan module, so do a quick pkg install for gmake and libgd and run the buildme.sh script. After some time, the Scan.so will show up in the build directory buried somewhere (in several locations, but I just used find to grab it). Copy Scan.so into /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan (you may need to create that directory) and things should work. Whew! There's a reason djoole compiled that file for us.

Restart the lms service and retriggger the scan and you should see your media library filling up. Even better, your squeezeboxes should be playing some music from your FreeNAS!

I modified the original script to not delete the lms-amd64-freebsd.tar.gz that's downloaded and instead put the Scan.so there so its available for later. I could upload it here so others could use it. Though it requires one to be a bit savy with scripts.

Still thanks a lot for the script, I doubt I would have gotten this far on my own. I've been away from working with FreeBSD for about 10 years and this brought me right back.
 

Schodoodles

Cadet
Joined
Dec 16, 2014
Messages
4
I modified the original script to not delete the lms-amd64-freebsd.tar.gz that's downloaded and instead put the Scan.so there so its available for later. I could upload it here so others could use it. Though it requires one to be a bit savy with scripts.

Any chance you can upload or fw via pm/email?
I made the fatal mistake of adding Plex to my FreeNAS and this killed LMS for me and though I've got it working the scanning function is dead and sounds like this is why.

I did the package install of gmake and libgd, copied the Scan.so from another folder into the one you've mentioned and restarted LMS but it still fails to scan.
Does this need a new install I assume of can this be hacked into place without this? Either is fine but need to know.

Thanks for posting though!
 
Joined
Jan 19, 2015
Messages
10
You probably don't need a new install. You do need to restart lms though so it sees the new module.

Otherwise, check lms server log (either via its web interface or on the command line). That's where I noticed it tripping over the module.

I'll PM you with a tarball. It seems uploading isn't working for me (or is disabled, which may be a wise move).
 

Schodoodles

Cadet
Joined
Dec 16, 2014
Messages
4
Hi,

Bit of an update so that anyone else struggling can see.
Finally managed to get this working with the following edits with all credit to NorwegianRockCat. I actually used a tarball NRC provided to do the full install but unsure if me mucking about late last night trying to fix this was the eventual issue before doing that. I just re-created the jail and did the other install steps plus the below. I did try using the find command and copying in the Scan.so to the mentioned folder but with no joy but maybe others can figure that one out.

1) Install gmake and libgd either as part of the script or after the package update at the very start.
pkg install -y gmake libgd

2) Once LMS is installed; Copy the Scan.so to /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan (Pretty much had to mkdir each folder from the 5.18 here)
cp /mnt/playlists/Scan.so /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan

3) Copy the autosplit.ix file to part of this as well after seeing an error that LMS couldn't find this in its main logs.
cp /usr/local/lms/CPAN/arch/5.18/x86_64-linux-thread-multi/auto/IO/Interface/autosplit.ix /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto

4) Restart the LMS Service.
Service lms restart

On the plus side; I have now learnt how to use the find command. :)
Hope this helps other relatively new FreeBSD/FreeNAS users like myself.
 
Joined
Jan 19, 2015
Messages
10
2) Once LMS is installed; Copy the Scan.so to /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan (Pretty much had to mkdir each folder from the 5.18 here)

On the plus side; I have now learnt how to use the find command. :)
Hope this helps other relatively new FreeBSD/FreeNAS users like myself.

Just wait til you find out that "mkdir -p" will create all the intermediate directories for you :)

Congratulations! I'm glad that you filled in the details as I was too sloppy to write them down as I was figuring them out.

Snapshot that jail so you have a working configuration and enjoy your streaming server (I certainly do). :)
 

nops

Cadet
Joined
Jan 21, 2015
Messages
1
Bit of an update so that anyone else struggling can see.
Finally managed to get this working with the following edits with all credit to NorwegianRockCat. I actually used a tarball NRC provided to do the full install but unsure if me mucking about late last night trying to fix this was the eventual issue before doing that.
Any chance I could get a copy of that tarball as well?

Once LMS is installed; Copy the Scan.so to /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan (Pretty much had to mkdir each folder from the 5.18 here)
cp /mnt/playlists/Scan.so /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan
I am reasonably new to FreeBSD and have been having troubles getting the 'buildme.sh' bash script on github to run in my vanilla jail to generate the Scan.so. Installed BASH, tried adding all sources,I must have made a wrong turn somewhere. I am able to browse my music volume and play files within lms, but scanner is coming up bust. Was Scan.so included in your tarball? If not, can you please help me to get that script to run so I can generate my own Scan.so? It seems this is where I'm stuck.

Hope this helps other relatively new FreeBSD/FreeNAS users like myself.
Yes! Thanks to you and NorwegianRockCat. Thanks to you both for your work together on documenting this. :)
 

Pandora

Dabbler
Joined
Dec 19, 2014
Messages
20
Hey there, i need your help on this one.
I installed it a while ago successfully. Today, i wanted to install it on a new jail and what i get now is this:

Code:
--2015-01-25 11:49:31--  http://djoole.free.fr/lms/lms-freenas-amd64.tgz   
Resolving djoole.free.fr (djoole.free.fr)... 212.27.63.154                 
Connecting to djoole.free.fr (djoole.free.fr)|212.27.63.154|:80... connected.
HTTP request sent, awaiting response... 200 OK                             
Length: 23598419 (23M) [application/x-gzip]                                
Saving to: ‘lms-freenas-amd64.tgz’                                         
                                                                           
100%[======================================>] 23,598,419  2.57MB/s   in 8.8s
                                                                           
2015-01-25 11:49:40 (2.55 MB/s) - ‘lms-freenas-amd64.tgz’ saved [23598419/235984
19]                                                                        
                                                                           
Updating FreeBSD repository catalogue...                                   
FreeBSD repository is up-to-date.                                          
All repositories are up-to-date.                                           
pkg: No packages available to install matching 'p5-Image-Scale' have been found
in the repositories                


"pkg update -f && pkg upgrade" didn't help.

I then thought "yeah no issue" and went with "pkg_add -r -v p5-Image-Scale", removed "p5-Image-Scale" from the installme.sh script and it installed fine.
But then, Perl 5.16 got installed, which doesn't seem to be supported by that package, as this would get me:
Code:
The following modules failed to load: DBI EV XML::Parser::Expat HTML::Parser JSON::XS Digest::SHA1 YAML::XS Sub::Name

when trying to start lms.

Any ideas? I'm a pretty noob in unix and this is driving me mad :D
 
Joined
Jan 19, 2015
Messages
10
Hello Pandora,

See my first post. You basically need to upgrade to Perl 5.18 through pkg and then build a new Scan.so to get music scanned.
 
Joined
Jan 19, 2015
Messages
10
I just ran 'pkg update' and Perl was listed as one of the things that would be updated. It shouldn't be any more magic than that. After all, the error you are getting is because the modules you installed are installed for 5.18.

It seems that there may be a broken dependency somewhere in the pkg tree (i.e., the Perl Modules should match what version of Perl is installed or update Perl or something), but I was more focused on getting things to run.
 

Pandora

Dabbler
Joined
Dec 19, 2014
Messages
20
I just ran 'pkg update' and Perl was listed as one of the things that would be updated. It shouldn't be any more magic than that. After all, the error you are getting is because the modules you installed are installed for 5.18.

It seems that there may be a broken dependency somewhere in the pkg tree (i.e., the Perl Modules should match what version of Perl is installed or update Perl or something), but I was more focused on getting things to run.

Doesn't work for me.
As said, when i run installme.sh i get "pkg: No packages available to install matching 'p5-Image-Scale' have been found in the repositories" .
So i removed p5-Image-Scale from the script and installed it manually via "pkg_add -r -v p5-Image-Scale".
Then i ran "pkg upgrade -f", which finally gives me version 5.18.

But then, after "service lms onestart", this occurs:
Code:
The following CPAN modules were found but cannot work with Logitech Media Server:
  Image::Scale (loaded  but missing object file, need 0.08)

To fix this problem you have several options:
1. Install the latest version of the module(s) using CPAN: sudo cpan Some::Module
2. Update the module's package using apt-get, yum, etc.
3. Run the .tar.gz version of Logitech Media Server which includes all required CPAN modules.
 
Joined
Jan 19, 2015
Messages
10
Ah, I see. I guess I meant upgrade.

Anyway, I did not run into the p5-Image-Scale for me, but it could be cause I was running 9.3 or I don't use the part of the server that needs it? Regardless, it looks like you have things running now. Good luck!
 

Pandora

Dabbler
Joined
Dec 19, 2014
Messages
20
I'm also on 9.3.

Sadly, not really running. Still the same issue...
I'm not able to start lms at all (don't think it's an issue if you really need p5-Image-Scale or not, it's there and it's causing problems).

If anyone else has some tips, i would appreciate it.
 
Joined
Jan 19, 2015
Messages
10
Ah, sorry that's the output from LMS, not you explaining what you did. My bad. It looks like you have the wrong image scale installed (it wants .08).

pkg info shows that I there is a p5-Image-Scale installed for me:

Code:
# pkg info p5-Image-Scale                                                                                          
p5-Image-Scale-0.08_5                                                                                                             
Name           : p5-Image-Scale                                                                                                   
Version        : 0.08_5                                                                                                           
Installed on   : Thu Jan 15 19:47:07 CET 2015                                                                                     
Origin         : graphics/p5-Image-Scale                                                                                          
Architecture   : freebsd:9:x86:64                                                                                                 
Prefix         : /usr/local                                                                                                       
Categories     : perl5 graphics                                                                                                   
Licenses       : GPLv2                                                                                                            
Maintainer     : atkin901@gmail.com                                                                                               
WWW            : http://search.cpan.org/dist/Image-Scale/                                                                         
Comment        : Perl module for fast, high-quality fixed-point image resizing                                                    
Shared Libs required:                                                                                                             
        libpng16.so.16                                                                                                            
        libperl.so.5.18                                                                                                           
        libjpeg.so.8                                                                                                              
        libgif.so.4                                                                                                               
Annotations    :                                                                                                                  
        repo_type      : binary                                                                                                   
        repository     : FreeBSD                                                                                                  
Flat size      : 127KiB                                                                                                           
Description    :                                                                                                                  
This module implements several resizing algorithms with a focus on low                                                            
overhead, speed and minimal features. Algorithms available are:                                                                   
                                                                                                                                  
  GD's copyResampled (floating-point)                                                                                             
  GD's copyResampled fixed-point (useful on embedded devices/NAS devices)                                                         
  GraphicsMagick's assortment of resize filters (floating-point)                                                                  
  GraphicsMagick's Triangle filter in fixed-point                                                                                 
                                                                                                                                  
Supported image formats include JPEG, GIF, PNG, and BMP for input, and                                                            
JPEG and PNG for output.                                                                                                          
                                                                                                                                  
WWW: http://search.cpan.org/dist/Image-Scale/


To be honest, pkg is new for me (I grew up using the ports tree), but perhaps there's some information here that's useful (unless it was pulled from the pkg tree last week).

Sorry that I can't help much more. If you can't get it from pkg, my next suggestion would be to try doing it via CPAN. It's less of an issue when you are doing this stuff in a jail.
 

Pandora

Dabbler
Joined
Dec 19, 2014
Messages
20
Sorry that I can't help much more. If you can't get it from pkg, my next suggestion would be to try doing it via CPAN. It's less of an issue when you are doing this stuff in a jail.

That worked! Using CPAN (didn't knew what it was 'till now) did actually help :)
I had to force install it, as the tests which were usually done did fail.

I'm going to update this post soon with what i did exactly, starting from creating a jail all the way to starting LMS the first time.

Thank you NorwegianRockCat!! Big help!

Update: Now I have some issues with scanning music, even after following above steps. LMS crashes, as soon as scanning begins, Scans.so seems to be the problem. Going to resolve that first.
 
Last edited:

Pandora

Dabbler
Joined
Dec 19, 2014
Messages
20
Okay, finally managed to get LMS running in a new jail on FreeNAS 9.3. This is what i did:

Prepare requirements
Code:
    1. Get the installme.sh from the first post here and edit it
        a. Look for "p5-Image-Scale" (around line 62) and remove it: the line should now say something like pkg install -y p5-DBI p5-EV p5-XML-Parser p5-HTML-Parser p5-JSON-XS p5-Digest-SHA1 p5-YAML-LibYAML p5-Sub-Name p5-Audio-Scan p5-DBD-SQLite p5-Class-XSAccessor p5-Template-Toolkit p5-IO-Interface sox
    2. open the shell of your jail
    3. pkg upgrade -f
    4. pkg_add -r -v wget
    5. rehash
    6. mkdir /usr/local/tmp
    7. cd /usr/local/tmp
    8. Transfer the file "installme.sh" into this folder (I use FileZilla for that)
    9. chmod 777 installme.sh
    10. pkg install graphics/libjpeg-turbo
    11. pkg install graphics/png


Fix the broken Image Scan module and install it
Code:
 
    1. cpan (At the first run of CPAN, you'll be asked two things first. just say yes to both questions)
    2. install Image::Scale
    3. If the build is now failing:
        a. Don't close cpan / shell yet! (otherwise the following steps won't have any effect)
        b. Use again FileZilla or something to go into your jail
        c. Open path "root/.cpan/build/"
        d. There's a folder called "Image-Scale-0.08…" -> go into it
        e. In that folder, open "src"
        f. Edit the file png.c
        g. Change "png_memcpy" to "memcpy" and save the file
        h. Back in the shell of your jail, where cpan is still running, type again: install Image::Scale
        i. Image Scale will now be built and installed successfully
        j. exit



Install LMS
Code:
     
    1. cd /usr/local/tmp
    2. ./installme.sh


Fix broken audio scanner
Code:
    1. pkg install -y gmake libgd
    2. Restart the jail
    3. service lms onestop
    4. Download https://github.com/Logitech/slimserver-vendor/tree/public/7.8 as zip to a client machine (Windows in my case)
    5. Extract it on your client
    6. Edit the file slimserver-vendor-public-7.8\CPAN\buildme.sh
        a. Look for:
        if [ ! -x /usr/bin/rsync ]; then
           echo "This script requires /usr/bin/rsync, please install it."
           exit
        fi
        b. And replace it with:
        if [ ! -x /usr/local/bin/rsync ]; then
           echo "This script requires /usr/local/bin/rsync, please install it."
           exit
        fi
    7. Save the file and copy the folder slimserver-vendor-public-7.8 to /usr/local/tmp on your jail
    8. cd /usr/local/tmp
    9. chmod -R 777 slimserver-vendor-public-7.8
    10. cd slimserver-vendor-public-7.8/CPAN
    11. pkg install bash
    12. pkg install rsync
    13. ./buildme.sh (takes several minutes)
    14. You can ignore the error messages
    15. mkdir -p /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan
    16. "find / -name Scan.so" and keep a path in mind
    17. (Here we copy from the path found in step 16) cp /usr/local/lib/perl5/site_perl/mach/5.18/auto/Audio/Scan/Scan.so /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/Media/Scan
    18. mkdir -p  /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/IO/Interface/
    19. "find / -name autosplit.ix" and keep a path in mind
    20. (Here we copy from the path found in step 19) cp /usr/local/lms/CPAN/arch/5.8/i386-freebsd-64int/auto/IO/Interface/autosplit.ix /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto
    21. (Here we copy from the path found in step 19) cp /usr/local/lms/CPAN/arch/5.8/i386-freebsd-64int/auto/IO/Interface/autosplit.ix /usr/local/lms/CPAN/arch/5.18/amd64-freebsd-thread-multi/auto/IO/Interface/
    22. service lms restart


Basically you're done now.

You can now add your music folder, like you usally would do in FreeNAS, restart it and head to [your.jail.ip]:9000.
I had to first run a full scan of the library, which didn't find anything. Then I started a rescan and the music began to index.

In my case, all my players had to be restarted (power off/power on) manually. And I also had to reselect to correct media library (add it manually if not shown).

The covers won't show up currently. There might be a bug in the image scale module, that's also why the build/install has to be forced, as the tests fail. But at least, everything else works as expected.


Hope this helps other people, which encounter the same issues I had. Good luck!

Credits go to:
djoole, NorwegianRockCat, Schodoodles (in this thread)
Roger Wilco: https://forums.freenas.org/index.ph...8-7-9-for-freenas-9-2-1-6-from-scratch.22359/
Michael Curtis: http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-October/241556.html
 
Last edited:

Levissy

Cadet
Joined
Jan 25, 2015
Messages
9
@Pandora

" c. Open path "root/.cpan/build/"
d. There's a folder called "Image-Scale-0.08…" -> go into it
e. In that folder, open "src"
"
I follow your instrucions step by step, but:

my root/.cpan/build/ directory is fully empty,,, don't find the "Image-Scale-0.08…"

What should I do?

(FreeNAS 9.3)

Thank you
 
Last edited:

Levissy

Cadet
Joined
Jan 25, 2015
Messages
9
@Pandora

PS:
root@lms:/usr/local/tmp # pkg info p5-Image-Scale

pkg: No package(s) matching p5-Image-Scale

I try : pkg upgrade -f ....Don't work :(
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Pandora's guide should *NOT* be followed. He used pkg_add, which is part of the old (discontinued as of last August) pkg system. He (and you) should be using pkg-ng instead.
 
Status
Not open for further replies.
Top