Solved [Solved] EZJail + Cuse4BSD (WebCamD) -> Operation not permit

Hi,

I'm attempting to install WebCamD and Lirc in a jail on FreeBSD 8.3.
My goal is to be able to send WOL packets to computers when I press a button on my remote control.

I am trying this out on a FreeBSD 8.3 virtual machine, and also a PFSense 2.1 virtual machine.
Ultimately I intend to have it run on my PFSense 2.1 physical router.

Unfortunately, I know almost nothing about FreeBSD, and I am trying to mostly Google my way through it.
I have mostly followed this guide so far: http://www.dscentral.in/2012/11/04/ezjail-on-pfsense/

I have EZJail, Lirc and WebCamD installed, and I did not see any errors during installation.
However, I have a problem trying to run the Cuse4BSD program that WebCamD needs.
I get these errors (both in FreeBSD 8.3 and PFSense 2.1):

Code:
kldload cuse4bsd
# kldload: can't load cuse4bsd: Operation not permitted

webcamd
# webcamd: Could not open /dev/cuse. Did you kldload cuse4bsd?

These are the commands I ran to set up EZJail, Lirc and WebCamD:

Code:
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/

pkg_add -r ezjail

ezjail-admin install -r "8.3-RELEASE" -h ftp.freebsd.org

ezjail-admin create -r /jails/lirc lirc 192.168.1.2

cd /usr/jails/basejail/usr/
 
mkdir ports

cd /jails/lirc/
 
mkdir baseports

mount_nullfs /usr/jails/basejail/usr/ports/ baseports

cd /jails/lirc/
 
mkdir baseboot

mount_nullfs /usr/jails/basejail/boot/ baseboot

cd /jails/lirc/usr

mkdir basebin

mount_nullfs /usr/jails/basejail/usr/bin/ basebin

service ezjail onestart

jexec 1 sh

cd /usr
 
unlink ports
 
ln -s /baseports ports

cd /
 
unlink boot
 
ln -s /baseboot boot

cd /usr
 
unlink bin

ln -s /usr/basebin bin

echo nameserver 8.8.8.8 >> /etc/resolv.conf
  
echo nameserver 8.8.4.4 >> /etc/resolv.conf

pkg_add -r lirc

pkg_add -r webcamd

kldload cuse4bsd
# kldload: can't load cuse4bsd: Operation not permitted

webcamd
# webcamd: Could not open /dev/cuse. Did you kldload cuse4bsd?

Any ideas on how to trouble shoot this?

Thanks,
Erik
 
Re: EZJail + Cuse4BSD (WebCamD) -> Operation not permitted

You cannot load kernel modules from inside a jail. This would defeat the whole purpose of having jails in the first place

You could try the following: load the module on the host and make the camera device accessible inside the jail via devfs.
 
Re: EZJail + Cuse4BSD (WebCamD) -> Operation not permitted

Thanks @worldi, that got me past the cuse4bsd problem.

I did the following:

Code:
exit

service ezjail onestop

I edited the jail section of /etc/defaults/devfs.rules to be this:
Code:
# Devices usually found in a jail.
#
[devfsrules_jail=4]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path 'cuse' unhide
add path 'cuse' mode 0666
add path 'ugen*' unhide
add path 'ugen*' mode 0666
add path 'usbctl' unhide
add path 'usbctl' mode 0666

Then
Code:
cd /usr/jails/basejail/boot/modules/

cp cuse4bsd.ko /boot/modules/

kldload cuse4bsd

serivce devd restart

service ezjail onestart 

jexec 2 sh

webcamd
#Cannot set realtime priority
#Cannot find USB device

I still have a problem that it can't find the USB device, but the cuse4bsd problem is fixed.
 
Last edited by a moderator:
Re: [Solved] EZJail + Cuse4BSD (WebCamD) -> Operation not pe

Thank you from here as well, cuse4bsd is now working with your instructions.

Edit: I found this follow-up post which asks almost exactly the question I also run into: https://forums.freebsd.org/viewtopi.../forums.freebsd.org/viewtopic.php?f=5&t=43978

I am also trying to set up webcamd from inside a jail in FreeBSD (9.1 in my case). I have webcamd inside the jail now running, and it proudly announces that it attached to the correct USB device of the camera (4.2), and that it creates the /dev/video0 and /dev/input/event0 devices.

However, these devices still do not exist (neither in the host nor in the jail) - what am I missing? Running webcamd in the host might be a problem (it's a minimal FreeNAS system).
 
Back
Top