[HOWTO] Install Serviio in Freenas 8.0.x

Status
Not open for further replies.

Hi-Liter

Explorer
Joined
Oct 6, 2011
Messages
83
/etc/hosts from the jail:
Code:
::1                   localhost localhost.my.domain
127.0.0.1          localhost localhost.my.domain
192.168.178.98  serviio serviio.freenas.local



Edit: I restarted the router and connection with the console works again, really strange, but I can't change the library paths, when I try saving my changes, I see this error in the console log:

2011-11-01 20:46:46,459 WARN [RepositoryView$8] Cannot connect to server: Internal Connector Error (1002) - The calling thread timed out while waiting for a response to unblock it.
 

Hi-Liter

Explorer
Joined
Oct 6, 2011
Messages
83
Edit: I restarted the router and connection with the console works again, really strange, but I can't change the library paths, when I try saving my changes, I see this error in the console log:

2011-11-01 20:46:46,459 WARN [RepositoryView$8] Cannot connect to server: Internal Connector Error (1002) - The calling thread timed out while waiting for a response to unblock it.
Update: This problem was caused by the fact that I had "Search for updates of currently shared files" checked. Once I unchecked that, saving worked.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Update: This problem was caused by the fact that I had "Search for updates of currently shared files" checked. Once I unchecked that, saving worked.

"Search for updates of currently shared files" is an option in the console?
With it unchecked does everything work now or did it just resolve the following error:

2011-11-01 20:46:46,459 WARN [RepositoryView$8] Cannot connect to server: Internal Connector Error (1002) - The calling thread timed out while waiting for a response to unblock it.
 

Hi-Liter

Explorer
Joined
Oct 6, 2011
Messages
83
Yes it is, see the screenshot below:
NdgaG.jpg


It fixed the "Internal Connector Error (1002)" that occurred every time I tried to save changes to the library. So far I can connect to the server without problems, I think I need to restart my router every time I restart the server, I keep you updated if I find out anything new.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Thanks for posting all your information, I'll work on mine later tonight, assuming I get time, and post what I find.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Does anyone know how to enable debug logging?

edit /mnt/tank/Serviio_Jail/Serviio_root/usr/local/serviio-0.6.0.1/config/log4j.xml

Code:
<category name="org.serviio">
      <priority value="INFO"/>
   </category>


to

Code:
 <category name="org.serviio">
      <priority value="DEBUG"/>
   </category>


I removed my previous jail and started over. I built this one from the how-to instead of the pre-built method. It works now, and I have no idea what is different.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Parks, thanks for the feedback, at least we know the HowTo method works. Which pre-built version were you using? amd64 or i386?

I'll have to go through rebuild whichever version you had trouble with and post a replacement to see if that helps the next person.

Hi-Liter, thanks for struggling to figure out what's happening with your setup. Is it possible there's a newer version of the firmware for your router that might fix the problem? Maybe it's caching some value and there's some setting/timer to release the cache?
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Parks, thanks for the feedback, at least we know the HowTo method works. Which pre-built version were you using? amd64 or i386?

I'll have to go through rebuild whichever version you had trouble with and post a replacement to see if that helps the next person.

Hi-Liter, thanks for struggling to figure out what's happening with your setup. Is it possible there's a newer version of the firmware for your router that might fix the problem? Maybe it's caching some value and there's some setting/timer to release the cache?

I have a 64 bit system so the amd64.
 

Hi-Liter

Explorer
Joined
Oct 6, 2011
Messages
83
I now confirmed that I need to restart my router every time I restart the server (for whatever reason) in order to make it work. I'm still curious about this and also about why it takes my XBMC (which I just set up to test serviio, gonna use a WD TV Live later) so long to find serviio. So I read about jails in the FreeBSD man pages (http://www.freebsd.org/cgi/man.cgi?query=jail&sektion=8), and I am now quite surprised this works at all. Here's an extract from the man pages:

If a network service is present in the host environment that binds all available IP addresses rather than specific IP addresses, it may service requests sent to jail IP addresses if the jail did not bind the port. This means changing inetd(8) to only listen on the appropriate IP address, and so forth. Add the following to /etc/rc.conf in the host environment:

sendmail_enable="NO"
inetd_flags="-wW -a 192.0.2.23"
rpcbind_enable="NO"

192.0.2.23 is the native IP address for the host system, in this example. Daemons that run out of inetd(8) can be easily set to use only the specified host IP address. Other daemons will need to be manually configured--for some this is possible through the rc.conf(5) flags entries; for others it is necessary to modify per-application configuration files, or to recompile the applications. The following frequently deployed services must have their individual configuration files modified to limit the application to listening to a specific IP address:

To configure sshd(8), it is necessary to modify /etc/ssh/sshd_config.

To configure sendmail(8), it is necessary to modify /etc/mail/sendmail.cf.

For named(8), it is necessary to modify /etc/namedb/named.conf.

In addition, a number of services must be recompiled in order to run them in the host environment. This includes most applications providing services using rpc(3), such as rpcbind(8), nfsd(8), and mountd(8). In general, applications for which it is not possible to specify which IP address to bind should not be run in the host environment unless they should also service requests sent to jail IP addresses. Attempting to serve NFS from the host environment may also cause confusion, and cannot be easily reconfigured to use only specific IPs, as some NFS services are hosted directly from the kernel.

This sounds like quite some restrictions and problems that could be caused by the jail, or did I not see something?
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hi-Liter,

Thanks for posting that.

This sounds like quite some restrictions and problems that could be caused by the jail, or did I not see something?

Jails are new to me but they've been around for awhile and are used by hosting companies to give customers their own private environments. I think running stuff like Serviio and other network apps in a Jail isn't unusual and if there wasn't some way for those apps to work in a Jail that Jails wouldn't be very useful.

Add the following to /etc/rc.conf in the host environment:

sendmail_enable="NO"
inetd_flags="-wW -a 192.0.2.23"
rpcbind_enable="NO"

Disabling sendmail in the host environment in the case of FreeNAS would mean potential problems with reports and warnings not being able to be sent. The inetd_flags are probably something to look at some more. I'll take a look at them and see, but here's what I found about the ones you posted above. It looks like the "-a" could be helpful.

-w Turn on TCP Wrapping for external services. See the
IMPLEMENTATION NOTES section for more information on TCP Wrappers
support.

-W Turn on TCP Wrapping for internal services which are built in to
inetd.

-a Specify one specific IP address to bind to. Alternatively, a
hostname can be specified, in which case the IPv4 or IPv6 address
which corresponds to that hostname is used. Usually a hostname
is specified when inetd is run inside a jail(8), in which case
the hostname corresponds to that of the jail(8) environment.

Thanks for looking up that info though. I hadn't seen that and you're right that it could be important.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
@Protosd
I noticed something, the rc.conf file inside the jail still has:

Code:
hostname="freenas"


which makes since because I copied /conf/base/etc to Serviio_root per the guide.

Does it matter or should it be "serviio"?

Looking at the freebsd man page for rc.conf it says the hostname should be "The fully qualified domain name". I was just checking some of this because outside the jail I have this warning:

Code:
/etc/rc: WARNING: $hostname is not set -- see rc.conf(5).


in /var/log/jail_serviio_console.log

Inside the jail /var/log/messages had the following error from serviio sm-mta:

Code:
SYSERR(root): hash map "Alias0": missing map file /etc/mail/aliases.db: No such file or directory


I corrected it by doing the following command inside the jail

Code:
newaliases


Now I get the following error in /var/log/messages

Code:
Nov  6 14:57:06 serviio sendmail[62082]: NOQUEUE: SYSERR(root): hash map "Alias0": unsafe map file /etc/mail/aliases.db: Group writable directory
Nov  6 14:57:06 serviio sendmail[62082]: NOQUEUE: SYSERR(root): Cannot create database for alias file /etc/mail/aliases


Not sure if any of them mean anything. I was having some intermittent connection issues that seem to be resolved by doing the things I listed above.
 

ProtoSD

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

You are correct, having the hostname the same in rc.conf could cause some OS confusion, changing it to serviio is ok. I'll have to update the HowTo. The entry in the /etc/hosts file inside the jail makes it a fully qualified domain name. Mail will complain like you noticed, but I don't really see why mail needs to be running inside the jail unless serviio needs it for some strange purpose. You could try 'chmod 775 /etc/mail' and 'chmod 664 /etc/mail/aliases' and see if that helps. If this were a normal system I wouldn't recommend doing that for security reasons, but it's just a jail. It still doesn't make sense why serviio is trying to use mail, but see if that fixes it and let me know so I can update the HowTo.

I looked at my setup and the alias file is there, but it could just a permission thing that is preventing it from being written to.

@Protosd
I noticed something, the rc.conf file inside the jail still has:

Code:
hostname="freenas"


which makes since because I copied /conf/base/etc to Serviio_root per the guide.

Anyway, thanks for the feedback.
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
Hi Parks,

You are correct, having the hostname the same in rc.conf could cause some OS confusion, changing it to serviio is ok. I'll have to update the HowTo. The entry in the /etc/hosts file inside the jail makes it a fully qualified domain name. Mail will complain like you noticed, but I don't really see why mail needs to be running inside the jail unless serviio needs it for some strange purpose. You could try 'chmod 775 /etc/mail' and 'chmod 664 /etc/mail/aliases' and see if that helps. If this were a normal system I wouldn't recommend doing that for security reasons, but it's just a jail. It still doesn't make sense why serviio is trying to use mail, but see if that fixes it and let me know so I can update the HowTo.

I looked at my setup and the alias file is there, but it could just a permission thing that is preventing it from being written to.



Anyway, thanks for the feedback.

I tried 775 /etc/mail and when I ran newaliases it complained about it being group writeable

The server seems to be working so I'm not going to worry about it.
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
First may i thank protosd and all others in this thread and those who made this possible. I joined up purely so that i can get this NAS working as a DLNA box too. Yes, i have a house full of Samsung TV's so you probably see why i'm driven to get this working :D

I'm a humble Win sysadmin so unix/FreeBSD is somewhat alien to me but i know the commands and have worked through the thread and the main guide learning as i go along. I don't think i've made any mistakes (well, after starting afresh 3 times with the same results).

In essence, the jail works but the serviio server doesn't. Issuing the JLS command, i can see that it's running. But: -

1. Pinging the IP from another machine works fine.
2. Visiting the /rest/application address in a browser gives me the same XML page as mentioned earlier in this thread.
3. I cannot see the server-side Serviio running.
4. The Serviio console cannot detect the server.
5. DLNA devices are not discovering the server.
6. I haven't made the changes to my install following the 06/11/2011 update to the guide.

Admittedly, i do not know where the logs are stored but i'm tracking them down now. But, am i missing something obvious here? Does the fact that i am using the USB version of FreeNAS prevent this from working and so must i use a whole 250GB disk just to load this correctly? Of course, i also used the LiveCD and installed to the USB stick too.

Cheers
Pops
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
It is recommended to run FreeNAS from a USB drive. The file system is read only though. So when you made the changes to the FreeNAS file system listed in Protosd's guide you should have done a

Code:
mount -wu /


then switch back to read only with

Code:
mount -ro /


then your changes will be permanent.

Now to your serviio jail - My first question is, did you install it manually or with the pre built system, was it 64 or 32 bit?

You might have to post some of your config files.
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
It is recommended to run FreeNAS from a USB drive. The file system is read only though. So when you made the changes to the FreeNAS file system listed in Protosd's guide you should have done a

Code:
mount -wu /


then switch back to read only with

Code:
mount -ro /


then your changes will be permanent.

Now to your serviio jail - My first question is, did you install it manually or with the pre built system, was it 64 or 32 bit?

You might have to post some of your config files.

parks853

Thanks for your post.

Yes, i discovered the write command from rummaging around a few forums and then noticed it was actually in the guide. I subsequently vi all the files i edited to make sure they were amended and saved.

I also installed it manually and had not used the files. I could give that a try perhaps. It's a 64-bit system too.

I'm finishing up from work so i will likely give it another go tonight. Will gladly post up the config files too. Where will i find the logs which i can glance over?

Cheers
Pops
 

parks853

Dabbler
Joined
Jul 26, 2011
Messages
36
parks853

Thanks for your post.

Yes, i discovered the write command from rummaging around a few forums and then noticed it was actually in the guide. I subsequently vi all the files i edited to make sure they were amended and saved.

I also installed it manually and had not used the files. I could give that a try perhaps. It's a 64-bit system too.

I'm finishing up from work so i will likely give it another go tonight. Will gladly post up the config files too. Where will i find the logs which i can glance over?

Cheers
Pops

I had better luck building it manually for some reason. I'm sure you are really close just have something set improperly.

From memory (so this stuff should be close) inside the jail
/usr/local/serviio-0.6.0.1/log/serviio.log

if you look at this post it tells how to enable debug logging in serviio.log

/var/log/messages has some info (not sure how useful)

while in the jail try
Code:
ps

and make sure java and serviio are listed as running processes
verify file permissions of /usr/local/serviio-0.6.0.1 are admin:admin recursive
I think
Code:
id -a admin

should verify you have a user called admin created and he is in the admin and wheel group (the user creation put admin in the wheel group also)
make sure rc.conf has hostname equal to serviio, make sure the jail parameters are not present
make sure your hosts file has your <serviio-ip> serviio serviio.freenas.local at the bottom

outside the jail try
Code:
df -k

make sure the mount points are there

/var/log/jail_serviio_console.log has some info (not sure how useful)

make sure rc.conf has hostname equal to freenas, make sure the jail parameters are present
hosts file should not point to your serviio jail ip address

Somewhere in this thread I list the ports that need to be open on the machine you are running serviio-console on. Also, make sure serviio-console has the remotehost parameter set and is pointing to your library.

Edit - I thought of a couple things, make sure you are are comfortable entering your jail and exiting your jail and knowing where are you. I know this bit me a few times. I use putty and always double check at the top of the window to verify I'm in the directory I think I'm in before writing changes to a file.

start outside the jail
1. copy a media file to your volume/pool media directory (guide is /mnt/tank/_MEDIA)
2. verify the jail is running
Code:
jls

3. enter the jail
Code:
jexec -U root <jail number from entering jls above> bash

4. verify java and serviio are running
Code:
ps

5. verify media you copied at step one is in your serviio media directory
6. setup serviio-console (here and here) on a remote machine
7. In serviio-console point to your serviio media directory (guide is /usr/local/serviio-0.6.0.1/MEDIA)
8. verify you can connect to your server with xbmc (or something similar)
9. connect using your renderer of choice

from there maybe it will be easier to know what is broken. There is so many things that could be wrong, hard to know what to do.
 

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
parks853

Thanks for the pointers. I've been looking at this in greater depth and following the steps carefully the last few days.

There is one item though that i cannot figure out. Due to the amendment of the hostname above, i can't seem to find the correct rc.conf files. For example, when following the help guide

Code:
Edit /etc/rc.conf (Only the rc.conf inside the jail)

Find the line with hostname="freenas" Change freenas to serviio and
save the file.


it comes up as a blank file. The guide implies that the rc.conf file is that standard one with freenas as the existing hostname. Looking at your earlier post, i am assuming that (outside the jail) this is the file found in Serviio_root/conf/base/etc. However, saving the file and looking for it outside the jail shows that it is actually saved in Serviio_root/etc. Should i then copy/paste the contents of the rc.conf file and amend it to reflect the serviio hostname within the jail? Which one is it?

Soldiering on.....

Pops
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
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:

jail_serviio_flags="-n 99"

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

Popolou

Dabbler
Joined
Nov 8, 2011
Messages
26
Thanks protosd. Now a GUI would be very slick.

To be honest, i think its the fact that i'm a newbie that it probably has to be spelled out to me.

Though, i think i am close to throwing in the towel on it all despite the efforts. On starting afresh i noticed that: -

- on entering the Jail via ssh, the contents of the /usr/local/serviio-0.6.0.1/ folder was empty.
- i then noticed that a few of the packages hadn't installed correctly.
- running ps within the jail didn't show java or serviio running (thanks parks853)

It seems to me that my amendments hadn't committed to anything done within the Jail and so i'm quite lost. Did this for a second time with the same results so it must be either a permissions issues or something fundamental with my setup. Frustrating since i get no error message at all along the way and now not really sure where to look. :(

Pops
 
Status
Not open for further replies.
Top