Hi,
is it a good idea to install latest kmod drivers into freenas host? latest virtualbos-ose-kmod version was compiled with the latest depended packages. and also latest kernel, to which it is integrated as it runs as a kernel module.
I was working on other solution - to compile the same version of virtualbox-ose in a jail, as it is now installed in Freenas 11.0-RC4 system. Currently it is virtualbox-ose-kmod 5.1.6, which matches revision 423390 of 5.1.6_1 version of virtualbox-ose.
Here are the steps and shell script you can use for automated build in a jail. Just create or copy vboxcreate.sh script into new 11.0 jail and execute it. Take a coffe, complilation takes more hours..
Steps to create new virtualbox jail
===================================
Jails -> Add Jail -> "virtualbox"
jexec virtualbox
vi vboxcreate.sh
#!/bin/sh
echo Installing virtualbox
rm -rf /usr/ports
# workaround for svn problem without ipv6 connectivity to use ipv4 svn.freebsd.org address
host svn.freebsd.org | awk '/has address/ { print $4 " svn.freebsd.org"; exit }' >> /etc/hosts
svn checkout --non-interactive --trust-server-cert -r 423390
https://svn.freebsd.org/ports/head /usr/ports
sed -i -e '/svn.freebsd.org/d' /etc/hosts
export BATCH=yes
# compilation of virtualbox-ose fails without bulding python3 port first
cd /usr/ports/lang/python3 && make install clean
cd /usr/ports/emulators/virtualbox-ose && make install clean
pkg -o ASSUME_ALWAYS_YES=YES install phpvirtualbox apache24 mod_php56
pkg -o ASSUME_ALWAYS_YES=YES clean
pw groupadd -n vbox -g 1001
echo "VBox123" | pw useradd -n vbox -c vbox -u 1001 -s /bin/sh -m -g vbox -G vboxusers -d /home/vbox -h -
sed -i -e 's/'\''pass'\'';/'\''VBox123'\'';/' /usr/local/www/phpvirtualbox/config.php
sed -i -e 's/apache24\/data/phpvirtualbox/g' /usr/local/etc/apache24/httpd.conf
sed -i -e '/AddType application\/x-gzip \.gz \.tgz/a\
\
AddType application\/x-httpd-php .php\
AddType application\/x-httpd-php-sources .phps\
' /usr/local/etc/apache24/httpd.conf
sed -i -e 's/#ServerName
www.example.com:80/ServerName 127.0.0.1:80/' /usr/local/etc/apache24/httpd.conf
sed -i -e 's/@constant('\''PHPVBOX_VER'\'')/"5.1-0"/' /usr/local/www/phpvirtualbox/endpoints/api.php
sysrc apache24_enable="YES"
sysrc vboxwebsrv_user="vbox"
sysrc vboxwebsrv_enable="YES"
service vboxwebsrv start
service apache24 start
echo Done. Connect to phpvirtualbox at
http://`ifconfig -a | grep inet | grep -v inet6 | grep -v 127.0.0.1 | awk '{print $2}'` with user "admin" password "admin"
sh vboxcreate.sh
In FreeNAS web interface
========================
Add Tunable, type "Loader":
vboxdrv_load="YES"
Add Tunable, type "rc.conf":
vboxnet_enable="YES"
and reboot to load vbox drivers.
I haven't tested it fully yet, as I don't have Freenas 11 on physical machine. Only running under other virtualbox and as it does not allow nested virtualisation, I cannot check it if it really works.
Please report back if you try it if it works or you suggest some changes.
Enjoy!