TVHeadend + webcamd in a Jail issues loading module

Status
Not open for further replies.

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Hi All,

I have a FreeNAS server which I would like to install Tvheadend in a Jail. I have installed Tvheadend and webcamd and Tvheadend runs just fine .. however, webcamd requires a kernel module cuse4bsd.ko which you can't load in a Jail setting.

I am trying to copy the module to /boot/modules and have it loaded on startup in the baseOS, however it is a read-only filesystem.

Is there any way to make it RW just for a small time to copy the module, and set it to load on boot?
I am running FreeNAS 9.2.1 so don't have a "Tunable" option that I can see ..
 
Last edited:

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Update:

In the base OS I loaded the kernel module into /tmp and loaded it from there, and that loaded fine ..
I then went back into my tvheadend jail and ran
webcamd -d 0.4
and got this:

Code:
Cannot set realtime priority
Attached to ugen0.4[0]
Loading firmware at '/boot/modules/dvb-usb-dib0700-1.20.fw', f=7
Creating /dev/dvb/adapter0/demux0
Creating /dev/dvb/adapter1/demux0
Creating /dev/dvb/adapter0/dvr0
Creating /dev/dvb/adapter1/dvr0
Creating /dev/dvb/adapter0/frontend0
Creating /dev/dvb/adapter1/frontend0
Creating /dev/input/event0


However if I run webcamd as a daemon with:
webcamd -d 0.4 -B
Then I do not see any /dev/dvb... in the jail, or the base OS /dev.

Anyone know how they are shown? Do I have to run devfs in my Jail?
 
Last edited:

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Hi, thanks ..
I have seen that page, but it confuses me .... I don't know where the rules are (jail or host) and I don't see the "qjail" command anywhere on the system.
Presumably I should be able to modify the jail I created with the web gui ... but not sure what parts to put where out of that guide ..
 
D

dlavigne

Guest
You can ignore all the qjail stuff (it's just another way to setup a jail). Basically you want these devfs rules:

add path 'cuse*' unhide
add path 'video*' unhide
add path 'dvb*' unhide
add path 'dvb/*' unhide
add path 'dvb/adapter0/*' unhide
add path 'dvb/adapter1/*' unhide

I don't think you need the input rules...
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Ok, but where do I put them? In the host /etc/devfs.rules or the Jails version, or both?
I can only start/stop the devfs on the host ....

Anyway putting them in the hosts /etc/devfs.rules and restarting devfs with "service devfs restart" did nothing to help ..

It seems strange that the jail app webcamd that is creating these devices in the jail, but you can only add rules to unhide them in the host ... surely you have to link them somehow ..

(By the way, cuse which was setup in the host is visible to host and jail without the unhide rule)
 
Last edited:

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
From reading around the forums, I have ended up adding the following to the end of /etc/defaults/devfs.rules in the host.

Code:
[devfsrules_unhide_dvb=123]
add path 'video*' unhide
add path 'video*' mode 0666
add path 'dvb*' unhide
add path 'dvb/*' unhide
add path 'dvb/adapter0/*' unhide
add path 'dvb/adapter1/*' unhide

[devfsrules_jail_tvheadend=123]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_unhide_dvb
add path zfs unhide


This should override the general jails rules preceding it for the "tvheadend" jail. However, still no device shows.
I also tried, as a test, to alter the permissions of the 'video' device, to see if that was the issue, but again no change ..

Can anyone please help me here ..
(By the way, in BSD what do the symbols following filenames mean .. e.g. @ or * or % etc ..., coming from linux ...)

Do I need to tell the Jail about the new ruleset maybe? If so how?
 
Last edited:

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Bump .. anyone?
 

sharky

Dabbler
Joined
Dec 6, 2015
Messages
23
Hey,

I can't help you with your jail but I'm interested in your setup. Do you really want to pass through a dvb card to that jail ? Or are you using iptv so you don't have to deal with the dvb card stuff which is a next big problem.
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Yes, I really want to run the dvb card in the jail, don't have much choice, as the host OS is read only and runs off the USB stick.
I am running tvheadend to talk to the card, iptv can receive tv streams from tvheadend, but I will be using the natural rtsp stream from tvheadend and a plex or emby tvheadend plugin to watch TV.

.. So if anyone can help me expose those device nodes to the jail ... that would be cool ...
 

sharky

Dabbler
Joined
Dec 6, 2015
Messages
23
I think Freenas is not the best solution for your purpose, I don't think you can't make it. I would first try FreeBSD , but if you're a beginner than it is a tough project. It's easiert to use a rpi3 and use that as your tvheadend server. I had the same idea, but my atom board does not allow pci passthrough ... at all so I switched to rpi3 solution.
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
I think FreeNAS can do the job fine ... I have seen other posts where folk have done it, but they have not given enough detail to replicate.
I no not want to add another server to my system with a pi ... have been down that road, I would rather keep all my "serving" jobs in one place, purely from a management perspective .... and I want to learn NAS/BSD as well ..

I have solved the following:
1. Got the cuse4bsd.ko kernel driver to load at boot.
2. Got webcamd to connect to the USB DVB device ..
3. Got tvheadend installed and running in a jail ..

All I need to complete the mission is to get the /dev/dvb* nodes exposed to the jail ..... why is this so hard ... I have seen other driver /dev/* nodes for other devices available in the jail ......
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Anyone have any extra helpful info to solve this problem?

The only other way I see to solve this, is to install ports on the base os (after making it writable) and installing webcamd, that would expose the devices in the base os, which would be
easy to expose to the jail in which tvheadend is running.

I know this is not good practice, but I have no answer's for doing it all in the jail.
 

sharky

Dabbler
Joined
Dec 6, 2015
Messages
23
Hi Bernard,

did you tried it as you have said in you last post? I don't think that doing changes to the host system is bad in general. If you know what you're doing it is fine. One of the main reasons "make the host system only readable" is that newbies don't corrupt there host systems. I really like that feature, but you're doing advanced stuff... . I would clone the latest boot image and implement the changes.If it's not working you can boot the working hostsystem and try it again ;-) .

Let me know how things going. If my nas wouldn't make such a terrible noise while writing I had already tried to implement it.
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Hey Sharky,
I will have some time to finish this tonight, my steps will be:

2. Setup tvheadend in a jail -- done
3. Make base OS writable and copy over cuse4bsd.ko kernel module and firmware file over to base OS from install in the jail. Make module load on boot. -- done
4. Copy over webcamd executable to base OS. Make run on boot -- todo
5. Expose dvb devfs nodes to the jail ... easy part ..
6. Make base OS read-only again.
7. TaDa ... tvheadend should talk to dvb-t ....

Will let you know if it works out .. or not.
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Hmm .... I ended up getting webcamd in the OS together with some libs it needed, however I get this error if I run it ..
webcamd: webcamd: illegal user name

If I run it with help (-h) it prints out the help ok, anything else and I get the above error ..
 

Bernard Mentink

Contributor
Joined
Apr 2, 2016
Messages
193
Or using behyve instead of jails ?

Passthrough should be possible

Interesting, I will checkout behyve's to see if it is possible ..

As per your previous comment, asking on the FreeBSD forums, I don't think it is relevant as they do not run read-only OS's ... and that is the issue.
 

Henius

Cadet
Joined
Jun 10, 2016
Messages
7
This is a very very interesting setup I seek assistance for.
Like the idea to have several servers/utilities in one box.
Currently I'm stuck with the above problems with exposing dvb dev nodes to jail.

Tested dvb card with virtual mythtv distro - was working fine.

Anyone was able to accomplish the task already?
 
Status
Not open for further replies.
Top