9.3 How to build and install LMS 7.9 from scratch

Status
Not open for further replies.

Roger Wilco

Explorer
Joined
Jul 17, 2014
Messages
65
@Fraoch

Hi,

You do not need to set any passwords in any scripts.
Do the created log files have 'lms' as owner and group?
I have
Code:
ls -al /var/log/lms/
total 20
drwxr-xr-x  2 lms   lms       5 Mar 21 22:57 .
drwxr-xr-x  3 root  wheel    43 Apr  2 23:00 ..
-rw-r--r--  1 lms   lms       0 Mar  3 22:17 perfmon.log
-rw-r--r--  1 lms   lms       0 Mar 21 23:20 scanner.log
-rw-r--r--  1 lms   lms    3054 Mar 28 00:44 server.log


What permissions does the lms script have?
I have
Code:
ls -al /usr/local/etc/rc.d/lms
-r-xr-xr-x  1 root  wheel  2745 Mar 31 01:24 /usr/local/etc/rc.d/lms




Just a shot in the dark, in the /usr/local/etc/rc.d/lms script the following lines need to look exactly this way:
Code:
# PROVIDE: lms
# REQUIRE: LOGIN
# KEYWORD: shutdown


Do not add or remove any whitespaces or anything or it won't work. See
Code:
The format of the lines is rigid. Each line must begin with a single `#', followed by
a single space, followed by ``PROVIDE:'', ``REQUIRE:'', ``BEFORE:'', or
``KEYWORD:''. No deviation is permitted.


in rcorder(8).

Did you create the file under Windows? Windows uses different line endings than Unix-like OSes (\r\n vs. \n). -Editor you'd see those ^M characters at the end of a line:
Vim with ^M

Can you post the output of:
Code:
rcorder /etc/rc.d/* /usr/local/etc/rc.d/*


Do you get this output:
Code:
service lms rcvar
# lms
#
lms_enable="YES"
#   (default: "")

Code:
service lms rcvar



If these things are also ok, then I am clueless, and you'll need to start reading how the rc.d framework works. A good starting point is
Practical rc.d scripting in BSD

HTH,
rw
 

Fraoch

Patron
Joined
Aug 14, 2014
Messages
395
Do the created log files have 'lms' as owner and group?
I have
Code:
ls -al /var/log/lms/
total 20
drwxr-xr-x  2 lms   lms       5 Mar 21 22:57 .
drwxr-xr-x  3 root  wheel    43 Apr  2 23:00 ..
-rw-r--r--  1 lms   lms       0 Mar  3 22:17 perfmon.log
-rw-r--r--  1 lms   lms       0 Mar 21 23:20 scanner.log
-rw-r--r--  1 lms   lms    3054 Mar 28 00:44 server.log
Same here:
Code:
ls -al /var/log/lms
total 26
drwxr-xr-x  2 lms  lms  5 Apr  2 09:06 .
drwxr-xr-x  3 root  wheel  29 Apr  5 00:00 ..
-rw-r--r--  1 lms  lms  0 Apr  1 10:25 perfmon.log
-rw-r--r--  1 lms  lms  6563 Apr  1 10:28 scanner.log
-rw-r--r--  1 lms  lms  582 Apr  2 09:15 server.log

What permissions does the lms script have?
I have
Code:
ls -al /usr/local/etc/rc.d/lms
-r-xr-xr-x  1 root  wheel  2745 Mar 31 01:24 /usr/local/etc/rc.d/lms
Looks fine:
Code:
ls -al /usr/local/etc/rc.d/lms
-r-xr-xr-x  1 root  wheel  3311 Apr  1 09:27 /usr/local/etc/rc.d/lms

Just a shot in the dark, in the /usr/local/etc/rc.d/lms script the following lines need to look exactly this way:
Code:
# PROVIDE: lms
# REQUIRE: LOGIN
# KEYWORD: shutdown
Also no problems that I can see:
Code:
  # PROVIDE: lms
  # REQUIRE: LOGIN
  # KEYWORD: shutdown

Did you create the file under Windows? Windows uses different line endings than Unix-like OSes (\r\n vs. \n). -Editor you'd see those ^M characters at the end of a line:
Vim with ^M
No, I created this file in an SSH session using nano. I copied and pasted it from this thread. Sometimes when I do that, line breaks get inserted where there shouldn't be and several lines were split up inappropriately in this file - I edited it and went through the file several times to make sure there are no improper line breaks.
Can you post the output of:
Code:
rcorder /etc/rc.d/* /usr/local/etc/rc.d/*


Do you get this output:
Code:
service lms rcvar
# lms
#
lms_enable="YES"
#   (default: "")

Code:
service lms rcvar
AHA! No, I do not get this at all. I get a long listing:

http://pastebin.com/Akz7awgW

I notice that /usr/local/etc/rc.d/lms is listed there, but the output isn't close to yours.

Thanks for your help!
 

Roger Wilco

Explorer
Joined
Jul 17, 2014
Messages
65
Looks fine:
Code:
ls -al /usr/local/etc/rc.d/lms
-r-xr-xr-x  1 root  wheel  3311 Apr  1 09:27 /usr/local/etc/rc.d/lms

How comes your script is longer than mine?


AHA! No, I do not get this at all. I get a long listing:

http://pastebin.com/Akz7awgW

I notice that /usr/local/etc/rc.d/lms is listed there, but the output isn't close to yours.

No. Your posted link is the output of
Code:
rcorder /etc/rc.d/* /usr/local/etc/rc.d/*


Here's mine:
http://pastebin.com/w44RWMRG

Your lms script is invoked much earlier that mine - it should be invoked after
/etc/rc.d/LOGIN
which is what the following line inside the lms-script says:
Code:
# REQUIRE: LOGIN


To be honest, I have no idea why. You could diff your and mine rcorder output and go through the not matching dependencies, but I still think there's something wrong with the lms-script.

Try to write a dummy rc.d-script like in the link I posted the last time to see whether it is invoked after /etc/rc.d/LOGIN

Sorry,
rw
 

Fraoch

Patron
Joined
Aug 14, 2014
Messages
395
How comes your script is longer than mine?

Very good question...it's nothing I can see. Whitespace? I'm finding some whitespace before line breaks and as I eliminate it, the script gets smaller by a few bytes.

Ah well. I think there's something wrong with my script although I can't see any differences between it and the one you posted (I copied-pasted in nano). I appreciate the help. I'll start just LMS manually.

Thank you Roger.
 

Roger Wilco

Explorer
Joined
Jul 17, 2014
Messages
65
@Fraoch

Hi,
You can get my lms file here:

http://pastebin.com/jtuvqvEJ

It is base64 encoded, just to make sure there are no whitespace problems or the like. Instructions how to decode it are also there...

In case it works, let me know :)

-rw
 

Fraoch

Patron
Joined
Aug 14, 2014
Messages
395
And that was it! It works! :D

I followed your instructions to decode it back into text and checked the MD5. It matched. I then copied the tmp file over to /usr/local/etc/rc.d/lms.

I checked the file with nano. I immediately noticed there were no whitespaces in front of each line - I've never used pastebin before, copying and pasting seems to add 4-5 spaces before each line.

Now LMS starts with every restart!

THANK YOU!:)
 

Roger Wilco

Explorer
Joined
Jul 17, 2014
Messages
65
@Fraoch

This is funny.
After I had posted the script in this thread I copied it into a file and everything was fine, so I didn't bother to put it on pastebin.

Right now I've checked the script from this thread against the one which now works for you, and the diff doesn't show any problematic things (only tabs have been replaced with spaces, and each empty line has one space added (I think, maybe I've removed them in my local version - don't know anymore)).
Basically copying the script from this thread into a file should be fine... (at least with vim - I've never used nano...)

Anyway, who cares - it works now :)

-rw
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
If it's useful to someone: I never had a problem copy-pasting from a text editor or a pastebin to nano in a SSH session on PuTTY but I know there is many problems with the web GUI terminal and with copy-pasting directly from the forum.
 

metz2

Cadet
Joined
May 25, 2015
Messages
3
The build failed for me.

What was different from the first post for me was that I had to install newer versions of these because they were not available anymore:
  1. pkg install nasm-2.11.06,1
  2. pkg install wget-1.16
And perl is now version 5.20.

Is it possible that this made the build fail?
Unfortunately, I got frustrated and deleted the jail including the log file...
 

Jollybully

Cadet
Joined
May 28, 2015
Messages
4
The build failed for me.

What was different from the first post for me was that I had to install newer versions of these because they were not available anymore:
  1. pkg install nasm-2.11.06,1
  2. pkg install wget-1.16
And perl is now version 5.20.

Is it possible that this made the build fail?
Unfortunately, I got frustrated and deleted the jail including the log file...

The build failed for me too after following the guide. Everything fell down at:
Code:
libmediascan-0.1/bindings/perl. make failed, aborting
 

glennpm

Cadet
Joined
Jul 23, 2014
Messages
8
I was able to get LMS working last night with a modified version of the instructions in this thread. Unlike the similar thread with the binary pre-packaged, the LMS built with these instructions includes album art.

I started with post #1 of this thread. The /usr/bin/perl reference is not updated after the initial upgrade -- it points to the now-dead perl5.18.4:

Code:
pkg update
pkg upgrade


I chose to fix this by re-creating the /usr/bin/perl link (I am not a FreeBSD expert, so there may be a better way to do this):

Code:
rm /usr/bin/perl
ln -s /usr/local/bin/perl5.20.2 /usr/bin/perl


I then found that the install references to nasm and wget no longer existed, so I used the following instead:

Code:
pkg install nasm
pkg install wget


Next, you have to substitute the correct logitechmediaserver reference. This comes from whichever version you choose to use from downloads.slimdevices.com.

Code:
wget http://downloads.slimdevices.com/nightly/7.9/sc/<YOUR SUBDIRECTORY>/logitechmediaserver-7.9.0-<YOUR VERSION STAMP>.tgz
tar xf logitechmediaserver-7.9.0-<YOUR VERSION STAMP>.tgz


You have to do this substitution throughout the instructions.

Next, you have to substitute "5.20" for "5.18" wherever it occurs in the instructions. So

Code:
cd /tmp/somedir/logitechmediaserver-7.9.0-<YOUR VERSION STAMP>/CPAN/arch/5.18


becomes

Code:
cd /tmp/somedir/logitechmediaserver-7.9.0-<YOUR VERSION STAMP>/CPAN/arch/5.20


You have to do this substitution throughout the instructions.

You also have to do the reverse and substitute 5.18 in the one instruction where it says 5.20. (instruction 7 under 'Remove the unused perl branches:')

Code:
rm -rf 5.18


After switching from the build_jail to the install jail remember to update the perl reference after the upgrade:

Code:
rm /usr/bin/perl
ln -s /usr/local/bin/perl5.20.2 /usr/bin/perl


Finally, I switched to the instructions in post #17 where it says to do so in post #1.

Everything seems to be working well now. Thanks to everyone who did all the heavy lifting!
 

Teots

Cadet
Joined
Nov 7, 2013
Messages
2
Hi,

I still have quite a lot of trouble getting this to run under the latest jail version (with Perl 5.20) and the latest commit on the public/7.9 branch (1e48070f96eea5f0434b3e0810b986dfaee50f6a).

Code:
perl -v
This is perl 5, version 20, subversion 2 (v5.20.2) built for amd64-freebsd-thread-multi


When I run the buildme.sh script it fails with:

Code:
/usr/bin/ld: /slimdevices/slimserver-vendor/CPAN/build/include/../lib/libavcodec.a(deinterlace.o): relocation R_X86_64_PC32 against `ff_pw_4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
*** [blib/arch/auto/Media/Scan/Scan.so] Error code 1

Stop in /slimdevices/slimserver-vendor/CPAN/libmediascan-0.1/bindings/perl.
make failed, aborting


Does anybody know how to fix that?
 

Get Amped

Cadet
Joined
Aug 2, 2015
Messages
7
The user 'fydo' over at forums.slimdevices.com posted something that fixed a similar problem for him:

I did some digging in the buildme.sh script and found this line:

ARCH=`/usr/bin/perl -MConfig -le 'print $Config{archname}' | sed 's/gnu-//' | sed 's/^i[3456]86-/i386-/' | sed 's/armv5tejl/arm/' `

However, when I run that command on the commandline, I get "amd64-freebsd-thread-multi" as a result. Presumably the "-thread-multi" is there because my perl is compiled with threading enabled.

The script checks for "amd64-freebsd" when compiling ffmpeg and since that's not exactly what my arch is, the 64-bit compile flag doesn't get set. I changed the script to always add the 64-bit compile flag and that solved it for me.
I am getting the same error as Teots using the latest 7.9 nightly and incorporating the changes to the process posted by glennpm. Unfortunately, I have no idea how to "always add the 64-bit compile flag" or if that will actually solve this error. Any assistance is greatly appreciated.
 

Get Amped

Cadet
Joined
Aug 2, 2015
Messages
7
I have successfully built and am running the latest 7.9 nightly (1438870722) in a FreeBSD jail on FreeNAS FreeNAS-9.3-STABLE-201506292332 on an HP Microserver Gen8 with 10GB RAM, a 16GB flash drive, a 120GB Samsung SSD and 4 x 4TB WD Red HDs.

My goal was to have 10TB+ of lz4 storage for media and run LMS on the SSD. FreeNAS boots from the flash drive installed in the internal USB port, the SSD uses the ODD bay and SATA connector and the WD Reds are in the 4 drive trays.

I struggled with getting LMS to build working from the information in this thread and tried at least a half dozen times before I found the path. The following commands are exactly what I used as I went through the process successfully. You will have to adapt them to your directory/storage structures as appropriate. The key to getting it working was making sure the symbolic links to perl/perl5 were done/redone in both jails.

Create two jails: one to build LMS and one to run it. Use Advanced mode, enter the IPv4 default gateway and check VIMAGE.

In build_LMS jail:
Code:
pkg update
pkg upgrade
pkg install bash
pkg install gmake
pkg install rsync
pkg install nasm
pkg install wget
pkg install libgd
mkdir /tmp/LMS
cd /tmp/LMS
wget linktothenightlybuildthatIcan'tputherebecauseIdon'thaveenoughposts
tar xf logitechmediaserver-7.9.0-1438870722.tgz
git clone linktothesourcerepositorythatIcan'tputherebecauseIdon'thaveenoughposts
ln -s -f /usr/local/bin/perl5.20.2 /usr/bin/perl
ln -s -f /usr/local/bin/perl5.20.2 /usr/bin/perl5
cd /tmp/LMS/slimserver-vendor/CPAN
./buildme.sh | tee /tmp/LMS/buildme.sh.log
cd /tmp/LMS/logitechmediaserver-7.9.0-1438870722/CPAN/arch/5.20
cp -Rp /tmp/LMS/slimserver-vendor/CPAN/build/arch/5.20/amd64-freebsd-thread-multi .
rm -rf i386-linux-thread-multi
rm -rf i386-linux-thread-multi-64int
rm -rf x86_64-linux-thread-multi
cd ..
rm -rf 5.8
rm -rf 5.10
rm -rf 5.12
rm -rf 5.14
rm -rf 5.16
rm -rf 5.18
cd /tmp/LMS
tar cf logitechmediaserver-7.9.0-1438870722_with_fbsd.tar logitechmediaserver-7.9.0-1438870722


In FreeNAS shell:
Code:
cp /mnt/SSD/jails/build_jail/tmp/LMS/logitechmediaserver-7.9.0-1438870722_with_fbsd.tar /mnt/SSD/jails/LMS/tmp


In LMS jail:
Code:
pkg update
pkg upgrade
pw groupadd -n lms -g 30001
pw useradd -n lms -u 30001 -g lms -s /usr/sbin/nologin -c "Logitech Media Server" -d /nonexistent
mkdir /usr/local/lms
tar xf /tmp/logitechmediaserver-7.9.0-1438870722_with_fbsd.tar -C /usr/local/lms
mv /usr/local/lms/logitechmediaserver-7.9.0-1438870722/* /usr/local/lms
rmdir /usr/local/lms/logitechmediaserver-7.9.0-1438870722
chown -R lms:lms /usr/local/lms
rm /usr/bin/perl
rm /usr/bin/perl5
ln -s -f /usr/local/bin/perl5.20.2 /usr/bin/perl
ln -s -f /usr/local/bin/perl5.20.2 /usr/bin/perl5


I created an additional storage source /mnt/SSD/lms_data with destination /mnt/lmsdata and set permissions:
Code:
chown -R lms:lms /mnt/lms_data/cache
chown -R lms:lms /mnt/lms_data/prefs


Create startup file: lms

This is trickier than it looks because it can't have any extra white space. I suggest getting it from the pastebin link up there ^^^^ (I'd put the link but I don't have enough posts)

Follow the instructions in the file.
Code:
mv lms /usr/local/etc/rc.d/
chown root:wheel /usr/local/etc/rc.d/lms
chmod 555 /usr/local/etc/rc.d/lms
echo 'lms_enable="YES"' >> /etc/rc.conf
echo 'lms_cachedir="/mnt/lms_data/cache"' >> /etc/rc.conf
echo 'lms_prefsdir="/mnt/lms_data/prefs"' >> /etc/rc.conf
echo 'lms_playlistdir="/mnt/Playlists"' >> /etc/rc.conf


Restart your jail and try to connect to the jail's ip address : 9000
 
Last edited:
Joined
Apr 12, 2014
Messages
7
Thank you Roger Wilco for writing the original step by step process!! Also thank you to Get Amped for your amended version - I am now up and running! Scanning music now... :)


PS: I also had to install sox (pkg install sox) to get my FLAC-FLAC transcodes working.
 
Last edited:

DrMacabre

Dabbler
Joined
Mar 25, 2014
Messages
10
hello,

I've been following step by step all the information in the topic and all i get when trying to manualy start the service is :

root@LMS:/ # service lms start
lms does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)

i have created the lms file using textwrangler and pasted the content of the startup file from Roger Wilco, setup the permission without getting any error.

I'm totally lost since i have almost no clue about what i'm doing here :/

EDIT : nevermind, i'm such a noob, i created the lms file outside of the jail... got it working now.
 
Last edited:

Vincèn

Patron
Joined
Oct 16, 2014
Messages
265
Followed all instructions but refuses to start :( the slimserver.pl exists well, I double-checked !!

Code:
root@SlimServer:/usr/local/etc/rc.d # service lms start                                                                            
Starting lms.                                                                                                                      
/usr/local/lms/slimserver.pl: not found                                                                                            
/usr/local/etc/rc.d/lms: WARNING: failed to start lms                                                                              
root@SlimServer:/usr/local/etc/rc.d #
 

Get Amped

Cadet
Joined
Aug 2, 2015
Messages
7
Followed all instructions but refuses to start :( the slimserver.pl exists well, I double-checked !!

Code:
root@SlimServer:/usr/local/etc/rc.d # service lms start                                                                           
Starting lms.                                                                                                                     
/usr/local/lms/slimserver.pl: not found                                                                                           
/usr/local/etc/rc.d/lms: WARNING: failed to start lms                                                                             
root@SlimServer:/usr/local/etc/rc.d #

That can happen if there is any white space at all in the lms file. How did you create it?
 
Status
Not open for further replies.
Top