FreeBSD: Installing VirtualBox — No rule to make target ‘/sys/kern/bus_if.m’ Compile Error

One of the reasons I need VirtualBox on my HP Pavilion laptop is that I need Windows system to access to my work environment. The program only runs on Windows or Mac. I suggested (or rather complained) to make it available for Linux users but to this day my wish hasn't granted.

So let's install VirtualBox from the ports.

The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibility of end result after following these steps (although I will try to help if you send me your questions/problems).

As always, check for updates on ports: # ports fetch # portsnap update

Now follow the instruction in the handbook, 21.3. FreeBSD as a Host. # cd /usr/ports/emulators/virtualbox-ose/ # make install clean ... kmk[2]: *** No rule to make target `/sys/kern/bus_if.m', needed by `/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.10_OSE/out/freebsd.amd64/release/obj/FreeBSDGeneratedKernelHeaders/bus_if.h'. Stop. kmk[2]: Leaving directory `/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.10_OSE' kmk[1]: *** [pass_installs_this] Error 2 kmk[1]: Leaving directory `/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.10_OSE' kmk: *** [pass_installs_order] Error 2 *** Error code 2 Stop in /usr/ports/emulators/virtualbox-ose. *** Error code 1 Stop in /usr/ports/emulators/virtualbox-ose.

Huh? Error? Let's see what went wrong.

kmk[2]: *** No rule to make target `/sys/kern/bus_if.m', needed by...

This line seems to be the root cause. It looks like /sys/kern/bus_if.m is missing? Indeed, there is nothing under /sys. Furthermore, /sys is a link to /usr/src/sys which means I'm missing kernel source files? I then downloaded src.txz from the FreeBSD site. # tar -C / -xvf src.txz

Then compile virtualbox again. This time it went through without any errors! Yahoo!

Now follow the rest of the steps in the handbook. Load the kernel module and update /boot/loader.conf to ensure the module gets loaded at each reboot: # kldload vboxdrv # vi /boot/loader.conf ------------------------------------ vboxdrv_load="YES"

For bridged or host-only networking, add the following to /etc/rc.conf and reboot the computer: # vi /etc/rc.conf ------------------------------------ vboxnet_enable="YES"

To use VirtualBox, all users need to be the member of vboxusers: # pw groupmod vboxusers -m <username>

The default permissions for /dev/vboxnetctl are restrictive and need to be changed for bridged networking: # chown root:vboxusers /dev/vboxnetctl # chmod 0660 /dev/vboxnetctl

Update /etc/devfs.conf to make above change permanent: # vi /etc/devfs.conf ------------------------------------ own vboxnetctl root:vboxusers perm vboxnetctl 0660

Finally, type VirtualBox in a terminal to launch it: $ VirtualBox &

That's all!


Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>