[HOWTO] Install Serviio in Freenas 8.0.x

Status
Not open for further replies.

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Pops,

Sorry for the delayed reply. I'm working on adding Jail control to the GUI so you can stop and start a jail, and later stop/start apps inside.

You are correct, the rc.conf file is blank inside the jail. I updated the HowTo based on Park's feedback and didn't completely look into it. You can copy the rc.conf outside the jail to use as a template, but there's a lot of un-needed stuff that needs to be removed. I think I'm going to update the HowTo again based on your feed back and add a template for the rc.conf inside the jail. So the rc.conf inside the jail or to be clear Serviio_root/conf/base/etc and Serviio_root/etc should both have the same hostname which should not be the same as your FreeNAS hostname.

There's one other change I'm going to add to the HowTo and it goes into the rc.conf of the FreeNAS server with the other jail settings. It looks like this:



It sets the Jail ID to a fixed number every time the jail gets started. So that example makes it 99, but you can change it to whatever number make you happy :)

Protosd,

Inside the jail I don't even have a rc.conf file in /etc. I only have a rc.conf file located at /conf/base/etc. That is the one I changed the hostname to serviio from freenas. Should I copy the rc.conf file from /conf/base/etc to /etc?

Pop,

I'll read back through your post to see if I see anything you can try. I apologize for the delay as well. I've been working on how to format my videos that I stick on the server.
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
Hey

Not at all, it's a massive learning curve for me and so am taking my time to learn it as i go along. I tend to jump right into things when i start out something new which can be very chaotic. Just need to persevere. Of course, any guidance would be greatly thankful, but also appreciate should it steer O/T.

I've got another fresh installation prepared so will upload my config into Freenas and give it another go from the top.

Rgds
pops
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Protosd,

Inside the jail I don't even have a rc.conf file in /etc. I only have a rc.conf file located at /conf/base/etc. That is the one I changed the hostname to serviio from freenas. Should I copy the rc.conf file from /conf/base/etc to /etc?

Yeah, I'd copy it to /etc, the one in /conf is like the template for /etc and I'm not sure how it's handled in the jail, but /etc *should* have priority. I updated the HowTo and just put a template rc.conf to put in /etc in the jail.

Pops,

Hang in there, I understand what you mean about
I tend to jump right into things when i start out something new which can be very chaotic.

I tend to do the same thing.

I've got another fresh installation prepared so will upload my config into Freenas and give it another go from the top.

I'm not sure I understand why you mean by that. Are you building the jail on another system and copying it after? I'm just asking for clarification in case something you are doing may be causing your problem.

Oh, in case I didn't already mention it somewhere... I don't use Serviio, I just made the Jail tutorial to try and make things simpler for everyone since there seemed to be a few people having trouble with the other method (Including myself). So Pops, as far as I know, you're the odd one and if we/you/us can figure out why you're having trouble I can try and fix the HowTo so others don't share your frustration.
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
Pops,

Hang in there, I understand what you mean about
I tend to jump right into things when i start out something new which can be very chaotic.

I tend to do the same thing.

I've got another fresh installation prepared so will upload my config into Freenas and give it another go from the top.

I'm not sure I understand why you mean by that. Are you building the jail on another system and copying it after? I'm just asking for clarification in case something you are doing may be causing your problem.

I wasn't very clear - i meant to say that i simply wipe the existing USB stick holding the working installation of Freenas 8 and reflash from new either by writing the downloaded image file or (as i just did last night) installed via the installation CD on boot up.

Oh, in case I didn't already mention it somewhere... I don't use Serviio, I just made the Jail tutorial to try and make things simpler for everyone since there seemed to be a few people having trouble with the other method (Including myself). So Pops, as far as I know, you're the odd one and if we/you/us can figure out why you're having trouble I can try and fix the HowTo so others don't share your frustration.

Ah i see. Essentially, i start off by writing a new USB image using the physdiskwrite app in DOS, thought i have also got an installation CD and run through the routine that way too. I read somewhere that the embedded installation may not be suited to such modifications but thought that as long as i enable write access to the filesystem (as per the first few commands in your guide) i should be fine. Though, in writing my previous paragraph, i am now wondering whether my success is dependent on the method that i upload Freenas to the USB key....

I'll scrap my notes and make another attempt at it tonight. Perhaps somewhere i am using commands that have since been updated as the guide is updated.

I'll get there! ;)
 

VNMan

Cadet
Joined
Aug 4, 2011
Messages
5
csup on FreeNAS 8.0.2

I have just upgraded from 8.0.1Beta4 to 8.0.2 using the CD upgrade method, everything seems to be ok. BUT....

When I try to use csup as I would on 8.0.1, this time the downloaded files have ", v" appended at the end. I tried to Google but found nothing on how to fix this so that I can "cd /usr/ports/net/serviio && make install clean"....

I am obviously missing something here :-(

Please somebody give me some pointers....
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
Alright lads, a quick update on my efforts (for those still hanging on! :)).

I carried out a fresh install of FreeNAS and updated using a backup file. I then went systematically through the How-To. All went very well and so i ran JLS outside the jail which confimed it was running fine. I ssh'd into the Jail and ran PS which again confirmed that both Serviio and Java were running. But then after a short while, i got odd results.

I discovered that the admin user created earlier was non-existent. Fine i thought, simply create it within the jail and then restart it. Only, i got the error: -

Starting jails: cannot start jail "serviio":

Hmm. So investigating i noticed that the mount point of /mnt/tank/_MEDIA to /mnt/tank/Serviio_Jail/Serviio_root/usr/local/serviio-0.6.0.1/MEDIA was broken. Checking the logs, /Serviio_Jail/Serviio_root/var/log contained: -

Nov 27 20:23:49 serviio newsyslog[11421]: logfile first created
Nov 27 20:23:49 serviio syslogd: kernel boot file is /boot/kernel/kernel
Nov 27 20:23:51 serviio root: /etc/rc: WARNING: failed to start sshd
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: _secure_path: /etc/login.conf is world writable
Nov 27 20:23:51 serviio /usr/sbin/cron[11595]: login_getclass: unknown class 'daemon'
Nov 27 20:25:00 serviio cron[11710]: _secure_path: /etc/login.conf is world writable
Nov 27 20:25:00 serviio cron[11710]: login_getclass: unknown class 'daemon'
Nov 27 20:25:00 serviio cron[11710]: _secure_path: /etc/login.conf is world writable
Nov 27 20:29:03 serviio syslogd: exiting on signal 15

Not sure what signal 15 meant but i suspect its similar to a windows fatal error which terminates the process. The log outside the Jail contained little other evidence. Looking at the log file jail_serviio_console.log i find: -

Setting hostname: serviio.
Generating host.conf.
Creating and/or trimming log files.
ln: /dev/log: Operation not permitted
Starting syslogd.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib
32-bit compatibility ldconfig path:
Clearing /tmp (X related).
Starting local daemons:.
Updating motd:.
Generating public/private rsa1 key pair.
Your identification has been saved in /etc/ssh/ssh_host_key.
Your public key has been saved in /etc/ssh/ssh_host_key.pub.
The key fingerprint is:
02:d9:63:cd:a8:70:e0:8f:0c:09:0b:b6:cf:a0:ba:87 root@serviio
The key's randomart image is:
+--[RSA1 1024]----+
|o.. |
|++.. o + |
|+oo + = o |
|.o+= + . |
|. ooo . S |
|. . |
|.. |
|E.. |
|.. |
+-----------------+
Generating public/private dsa key pair.
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
13:e9:4d:a5:c0:e3:84:e8:72:f4:00:44:de:cf:f3:c0 root@serviio
The key's randomart image is:
+--[ DSA 1024]----+
| o+. . o. . |
| . .+ . +o o |
| .o.o oo.o |
| . o+...+ |
| o E S . |
| + . |
| . |
| |
| |
+-----------------+
Generating public/private rsa key pair.
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
5d:3f:d0:22:40:f8:24:3a:1f:8f:f5:6e:07:4c:c1:b6 root@serviio
The key's randomart image is:
+--[ RSA 2048]----+
| oo. |
| o ..+ . |
| . + ..o+ . |
| o . o.Eo + |
| o =S+. o |
| o . + . |
| . . |
| o . |
| . . |
+-----------------+
Starting sshd.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@^M
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @^M
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@^M
Permissions 0777 for '/etc/ssh/ssh_host_rsa_key' are too open.^M
It is recommended that your private key files are NOT accessible by others.^M
This private key will be ignored.^M
bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key^M
Could not load host key: /etc/ssh/ssh_host_rsa_key^M
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@^M
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @^M
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@^M
Permissions 0777 for '/etc/ssh/ssh_host_dsa_key' are too open.^M
It is recommended that your private key files are NOT accessible by others.^M
This private key will be ignored.^M
bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key^M
Could not load host key: /etc/ssh/ssh_host_dsa_key^M
Disabling protocol version 2. Could not load host key^M
sshd: no hostkeys available -- exiting.^M
/etc/rc: WARNING: failed to start sshd
Starting cron.

Sun Nov 27 20:23:51 GMT 2011
Stopping cron.
.
Terminated

Again, those last few lines seem rather ominous. Is it a matter of locking down the files? If this is the reason why it all shuts down, how do i go about fixing it?

I am still investigating the log files if there is anything that would shed further light on the hiccup.

Cheers
Pops



ETA - Ok, i went to where those files where and discovered that if i chmod 600 both /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key i no longer get the terminated processes and no complaints on the key's being open. :D
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
One other thing i just noticed. In the How-To, there is a step for the mount points such as (my emphasis): -

mount -t devfs devfs /mnt/tank/Serviio_Jail/Serviio_root/dev
mkdir -p /mnt/tank/Serviio_Jail/Serviio_root/usr/local/serviio-0.6.0.1/MEDIA
mount_nullfs -o rw /mnt/tank/_MEDIA /mnt/tank/Serviio_Jail/Serviio_root/usr/local/serviio-0.6.0.1/MEDIA

However, towards the end when you make the additions to the rc.conf file: -
#
jail_enable="YES"
jail_set_hostname_allow="YES"
jail_list="serviio"
jail_serviio_hostname="serviio"
jail_serviio_flags="-n 99"
jail_serviio_ip="10.0.10.150"
jail_serviio_interface="em0"
jail_serviio_rootdir="/mnt/tank/Serviio_Jail/Serviio_root"
jail_serviio_devfs_enable="YES"
jail_serviio_mount_enable="YES"
jail_serviio_fstab="/etc/fstab.serviio"
#jail_serviio_exec_afterstart="" (will start a command inside jail after booting)

Oddly, i seem to have success starting the jail with the mount points working by adding /dev to jail_serviio_rootdir="/mnt/tank/Serviio_Jail/Serviio_root" within rc.conf: -

jail_serviio_rootdir="/mnt/Raid/Serviio_Jail/Serviio_root/dev"

No idea why but it does :D

Pops
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hi Pops,

Lots of stuff to answer, let me see if I can get it all.

I discovered that the admin user created earlier was non-existent. Fine i thought, simply create it within the jail and then restart it. Only, i got the error: -

Hmm, makes me wonder where the admin account ended up. It should be created inside the jail, but the HowTo does it inside 'chroot' before the jail is initially run.

If ssh isn't working for you, you can always use 'jexec -U root JID bash' where JID is the id # you see when you do 'jls'.

Starting jails: cannot start jail "serviio":

You'll get this error if the jail is already started.

Again, those last few lines seem rather ominous. Is it a matter of locking down the files? If this is the reason why it all shuts down, how do i go about fixing it?

The ssh keys shouldn't prevent Serviio from starting. You could probably just get away with disabling the keys and using password authentication.

Can anyone else here comment on using ssh to access their jail?

I usually ssh to my FreeNAS server and then use 'jexec' to login to the jail like the example I wrote above.

Edit: I see you fixed the key problem, I'm not sure why the heck cron is complaining not starting.

One other thing i just noticed. In the How-To, there is a step for the mount points such as (my emphasis): -

mount -t devfs devfs /mnt/tank/Serviio_Jail/Serviio_root/dev
mkdir -p /mnt/tank/Serviio_Jail/Serviio_root/usr/local/serviio-0.6.0.1/MEDIA
mount_nullfs -o rw /mnt/tank/_MEDIA /mnt/tank/Serviio_Jail/Serviio_root/usr/local/serviio-0.6.0.1/MEDIA
However, towards the end when you make the additions to the rc.conf file: -

The steps in the beginning are just for getting things setup inside the jail, the part in the rc.conf file makes the changes permanent so the jail starts when you reboot.

Oddly, i seem to have success starting the jail with the mount points working by adding /dev to jail_serviio_rootdir="/mnt/tank/Serviio_Jail/Serviio_root" within rc.conf: -

jail_serviio_rootdir="/mnt/Raid/Serviio_Jail/Serviio_root/dev"
No idea why but it does

If it works.... my only guess it that you possibly mistyped something somewhere.

If I had more time I'd offer to login remotely and help you. Your problems seem very non-typical, but you get an A for persistence!
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
Cheers protosd

Yup, i eventually realised that almost all the peculiarities i experienced was due to the keys so pretty much the admin account disappearing, mount points and failed starts were somehow all seemingly associated to the keys. How very odd....:confused:

But, after messing about so much i got the message Could not create the Java virtual machine. So now that i know what's going on, the new plan is to blow away the current install, burn a fresh copy and give it another go. Just not now... don't think i can take much more of the punishment tonight :)

Thanks again for your assistance fella's.

Rgds
Pops
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
Wanted to drop a quick line to both protosd and parks853 to say thanks for putting up with me while i attempted to install Serviio in the jail. I managed to get it working and after a few nights testing it's seemingly faultless.

With FreeNAS now up and running too, it looks to be a sweet little set up.

Cheers lads.
Pops
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Wanted to drop a quick line to both protosd and parks853 to say thanks for putting up with me while i attempted to install Serviio in the jail. I managed to get it working and after a few nights testing it's seemingly faultless.

With FreeNAS now up and running too, it looks to be a sweet little set up.

Cheers lads.
Pops

Very glad to hear you are enjoying it!
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Wanted to drop a quick line to both protosd and parks853 to say thanks for putting up with me while i attempted to install Serviio in the jail. I managed to get it working and after a few nights testing it's seemingly faultless.

With FreeNAS now up and running too, it looks to be a sweet little set up.

Cheers lads.
Pops

I'm also really glad to hear you finally got it going, thanks for the update. Do you know what the problem was? Is there anything I can change in the HowTo to make it better?
 
Joined
Dec 11, 2011
Messages
17
I'm also really glad to hear you finally got it going, thanks for the update. Do you know what the problem was? Is there anything I can change in the HowTo to make it better?

cheers protosd,
Thanks for your work, I will be setting it up this way next time ;) when 8.0.3 comes out...
for now seems jails like a handy way to add "modules" to our freenases

PS1.
In your, "how to" the serviio.sh contains
-Dderby.system.home=/usr/local/serviio-0.6/library
which doesn't seem sane, it should point to $SERVIIO_HOME/library
did you used the serviio.sh which came with 0.6 or 0.6.0.1?
PS2.
also I think memory is too low i remember having problems with it :-Xmx384M I sugest to increase it if you have memory.
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
I'm also really glad to hear you finally got it going, thanks for the update. Do you know what the problem was? Is there anything I can change in the HowTo to make it better?
Thanks guys. i think it was due to needing to lock the keys down. Many times i'd see the jail up and running only for it the eventually crash and not start up again. It was a quick fix (as my post above) after a look through the logs. Of course, it could just be a noob problem (ie my lack of experience on freebsd generally) using a fresh install of Freenas. Otherwise, the guide was spot on so thanks for putting the time into it.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
cheers protosd,
Thanks for your work, I will be setting it up this way next time ;) when 8.0.3 comes out...
for now seems jails like a handy way to add "modules" to our freenases
Yes, Jails are pretty useful. I need to verify this, but I think PBI's (push button installs) actually use Jail(s), so it would be worth understanding them to be prepared for them when they are implemented in FreeNAS. There's a PC-BSD PBI called "Warden" which is a Jail management App that would also be useful to look at.

PS1.
In your, "how to" the serviio.sh contains
-Dderby.system.home=/usr/local/serviio-0.6/library
which doesn't seem sane, it should point to $SERVIIO_HOME/library
did you used the serviio.sh which came with 0.6 or 0.6.0.1?
PS2.
also I think memory is too low i remember having problems with it :-Xmx384M I sugest to increase it if you have memory.

I don't remember which service.sh I used, I think I actually edited the one from 0.6.0.1 since that's what I installed. You're correct about the library, that should be 0.6.0.1, I'll fix that. As for the memory, I don't use Serviio, I just created this for other people since there were so many people interested and they seemed to have trouble with filling in details in the existing tutorial (I even had trouble). I have another jail that I use for Jdownloader and have the memory set to 512 for that. I don't know if anyone has had trouble with it set at 384, it might be because of the jail, or who knows?, I'll fix that too!

Thanks for catching those important details! Also, thanks again for your work on this too! I wouldn't have been as motivated to do the jail version without the info you figured out.
 
Joined
Dec 15, 2011
Messages
1
for some reoson this is by far the most dificult thing to do.

i like the idea but in other to achieve this you need to go up and down left and right then do it again.. is there any simplest way of doing this or compile another how to on it.. and some recommendation have a 2g flash at first its ok everything worked out but none the less at the end everything got lost..
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hi Jeremy,

Which tutorial were you trying to use? The one in the beginning of this thread or the "Jail" version?

I agree if you mean the one at the beginning of this thread, I tried to follow it myself when writing the tutorial for the Jail version. Right now the Jail version is probably the simplest way. If you use the Jail version, you only need to backup 3 files: rc.conf, sysctl.conf, fstab.serviio.

You can find the HowTo for the Jail version here if you haven't seen it already:

[HOWTO] Install Serviio in a FreeBSD Jail on FreeNAS 8.0.x
 

crpd

Cadet
Joined
Dec 20, 2011
Messages
4
Hi all,
I'm a noob at this, I've been using freenas 7 and wanted to add serviio, will this jail setup work for 7 as well?

TIA
 

LAYGO

Explorer
Joined
Dec 21, 2011
Messages
85
This is probably the ultimate noob question, but I can NOT get the chown command to work.

I think I just figured it out. Going to copy the logs to show that I'm trying different ways to get chown to work & I noticed the error while adding the admin.

JAIL &> adduser
Username: admin
Full name: admin
Uid (Leave empty for default):
Login group [admin]: admin
Login group is admin. Invite admin into other groups? []: wheel
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]: bash
Home directory [/home/admin]: /usr/local/serviio-0.6.0.1
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: yes
Use an empty password? (yes/no) [no]: yes
Lock out the account after creation? [no]: no
Username : admin
Password : <blank>
Full Name : admin
Uid : 1001
Class :
Groups : admin wheel
Home : /usr/local/serviio-0.6.0.1
Home Mode :
Shell : /usr/local/bin/bash
Locked : no
OK? (yes/no): yes
pw: group `admin' does not exist
adduser: ERROR: There was an error adding user (admin).

Add another user? (yes/no): no
Goodbye!
JAIL &> chown -R admin:admin /usr/local/serviio-0.6.0.1/
chown: admin: Invalid argument
JAIL &> chown -R admin:admin /usr/local/serviio-0.6.0.1
chown: admin: Invalid argument
JAIL &> chown -R admin /usr/local/serviio-0.6.0.1
chown: admin: Invalid argument
JAIL &> pwd
/usr/local/serviio-0.6.0.1/bin
JAIL &> cd ../
JAIL &> pwd
/usr/local/serviio-0.6.0.1
JAIL &> chown -R admin:admin /usr/local/serviio-0.6.0.1/
chown: admin: Invalid argument
JAIL &> chown -R admin:admin /usr/local/serviio-0.6.0.1
chown: admin: Invalid argument
JAIL &> chown -r admin:admin /usr/local/serviio-0.6.0.1
chown: illegal option -- r
usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group] file ...
chown [-fhvx] [-R [-H | -L | -P]] :group file ...
JAIL &> chown -R admin:admin /usr/local/serviio-0.6.0.1/
chown: admin: Invalid argument
JAIL &> pwd
/usr/local/serviio-0.6.0.1
JAIL &> chown -R admin:admin .
chown: admin: Invalid argument
JAIL &> chown -R admin:wheel .
chown: admin: Invalid argument
JAIL &> cat /etc/passwd
# $FreeBSD: src/etc/master.passwd,v 1.40.22.1.6.1 2010/12/21 17:09:25 kensmith Exp $
#
(misc stuff here - but no admin)

(Off to look how to create/add the group 'admin')
 

LAYGO

Explorer
Joined
Dec 21, 2011
Messages
85
Or not . . . groupadd isn't available in the jail.

Workaround: adding admin to wheel as main group & not inviting to any other groups.
 
Status
Not open for further replies.
Top