Solved phpVirtualbox inside a jail

Not sure where this belongs

# kldstat |grep -i vbox
Code:
24  3 0xffffffff8201a000 45370  vboxdrv.ko
31  1 0xffffffff82060000 3f64  vboxnetadp.ko
32  1 0xffffffff82064000 29b2  vboxnetflt.ko
# vboxheadless
Code:
VBoxHeadless: Error -1908 in suplibOsInit!
VBoxHeadless: Kernel driver not installed

VBoxHeadless: Tip! Make sure the kernel module is loaded. It may also help to reinstall VirtualBox.
# sysctl security.jail.sysvipc_allowed
Code:
security.jail.sysvipc_allowed: 1

There aren't much howtos on this topic, a lot on how to do this in Linux, some how to do this in FreeNAS, though those for FreeNAS, work with a jail template.

Probably some issue with the jail not getting enough access to something, can anyone point me in the right direction? devfs(8)?
 
Last edited by a moderator:
  • Thanks
Reactions: Oko
You might need to do something like

Code:
jail -m jid=3 allow.sysvipc=1

where 3 should be replaced with ID number of the jail in which you are trying to run VirtualBox. I am just guessing based upon what is needed for PostgreSQL. Now the next question is how to run multiple virtual box instances in the different Jails and then you will have the problem again

This guy talks about it

https://www.textplain.net/tutorials/2015/running-postgresql-in-freebsd-jails/

This was pointed out by Kristaps Johnson as the fundamental design flood of the Jail infrastructure.
 
Unfortunately it is already
# sysctl security.jail.sysvipc_allowed
Code:
security.jail.sysvipc_allowed: 1
 
Last edited by a moderator:
I do that in the jail itself. I don't use any jail management you probably mean jls? It's JID 4.

Also I ran: jail -m jid=4 allow.sysvipc=1 Just to make sure. However it makes no difference.
 
Last edited by a moderator:
As far as I know the jail needs to be restarted for these settings to take hold.
 
I've even rebooted. No difference.

# kldstat|grep -i vbox
Code:
22  3 0xffffffff81ea4000 6d430  vboxdrv.ko
23  1 0xffffffff81f12000 5c10  vboxnetadp.ko
24  2 0xffffffff81f18000 73f8  vboxnetflt.ko
# uptime
Code:
4:21PM  up  8:12, 0 users, load averages: 0.63, 0.39, 0.20
# vbox
Code:
vboxautostart  vboxballoonctrl vboxheadless  vboxmanage  vboxsdl  vboxwebsrv
# vboxheadless
Code:
VBoxHeadless: Error -1908 in suplibOsInit!
VBoxHeadless: Kernel driver not installed

VBoxHeadless: Tip! Make sure the kernel module is loaded. It may also help to reinstall VirtualBox.
# sysctl security.jail.sysvipc_allowed
Code:
security.jail.sysvipc_allowed: 1
 
Last edited by a moderator:
I do that in the jail itself. I don't use any jail management you probably mean jls? It's JID 4.

Also I ran: jail -m jid=4 allow.sysvipc=1 Just to make sure. However it makes no difference.
You do that on the host and then restart the jail
 
Last edited by a moderator:
Is in jail.conf:
Code:
allow.sysvipc = 1;

But after rebooting I still do it. Just to make sure.
 
Last edited by a moderator:
I probably found the reason why it doesn't work
ls /dev/vbox*
Code:
/dev/vboxdrv  /dev/vboxdrvu  /dev/vboxnetctl
How do I enable those in the jail?
 
Last edited by a moderator:
  • Thanks
Reactions: Oko
sSolved so far:
Code:
add path 'vbox*' unhide

aAdded to devfs.rules:
Code:
[devfsrules_jail=4]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path zfs unhide
#cust
add path 'bpf*' unhide
add path mem unhide
add path kmem unhide
add path 'vbox*' unhide
 
  • Thanks
Reactions: Oko
At this point everything seems to work fine, I also had to compile virtualbox-ose-kmod with vimage support since i'm using VIMAGE jails, but the reason that the kernel driver didn't show was because of the setting in devfsrules. Everything seems to be working smooth right now, although the cpu usages on multicore xeon is 100% for windows 7 pro 64bit I think it's the update proces running in the background at boot it runs at 8% dedicated 2gig of ram to it, and 256 of video memory (max).

At this point it's running as root in its own jail, I'll try and move it to a normal user asap. When I've managed that I'll post a step by step guide.
 
any update about the performance and how many virtual machines are you running in that jail? I also plan to move my Virtualbox+phpVirtualbox in a jail. And to have the "datastore" for virtual machines on host, of course. Thanks!
 
See for yourself look at VBoxHeadless, I run for example 2x ubuntu 1x elastix (centos) one is an NVR server one is a sip server and one is running ubuntu server for my desktops (landscape). That and 3 other jails, total of 4 jails.

Also noticed that the maximum of disk size was 512gb, .. used default settings (dynamic size).

The system is a Intel(R) Xeon(R) CPU E3-1265L v3 @ 2.50GHz with 16gb (ecc) of ram and zfs. I'm going to add extra ram, already added extra swap because, needed more ram.

Though I have to add if you're planning on running something with gui it's probably going to use more CPU.
 

Attachments

  • top.png
    top.png
    114.5 KB · Views: 825
Back
Top