Installing VirtualBox™

Note: To run VirtualBox™, an Xorg session is needed. Refer to the handbook’s section on the X Window System to install and configure Xorg.

VirtualBox™ is available as a FreeBSD package or port in emulators/virtualbox-ose. To quickly install the package: 

# pkg install virtualbox-ose

The kernel module vboxdrv will need to be loaded before VirtualBox™ is started for the first time: 

# kldload vboxdrv

To ensure the module is always loaded after a reboot, add this line to /boot/loader.conf:

vboxdrv_load="YES"

To use the kernel modules that allow bridged or host-only networking, add this line to /etc/rc.conf and reboot the computer:

vboxnet_enable="YES"

The vboxusers group is created during installation of VirtualBox™. All users that need access to VirtualBox™ will have to be added as members of this group. pw can be used to add new members:

# pw groupmod vboxusers -m yourusername

The default permissions for /dev/vboxnetctl are restrictive and need to be changed for bridged networking. To permanently change these permissions, add these lines to /etc/devfs.conf:

own     vboxnetctl root:vboxusers
perm    vboxnetctl 0660

To launch VirtualBox™, type from an Xorg session:

# VirtualBox
 

VirtualBox™ USB Support

Users will need to be members of the operator group For VirtualBox™ to be aware of USB devices.

# pw groupmod operator -m yourusername
Then, add the following to /etc/devfs.rules, or create this file if it does not exist yet:
[system=10]
add path 'usb/*' mode 0660 group operator

To load these new rules, add the following to /etc/rc.conf:

devfs_system_ruleset="system"

Then, restart devfs:

# service devfs restart
Both the login session and VirtualBox™ will need to be restarted for any changed to take effect.

 

VirtualBox™ Host DVD/CD Access

The HAL daemon needs to run for VirtualBox™ DVD/CD functions to work, so enable it in /etc/rc.conf and start it if it is not already running:

hald_enable="YES"
# service hald start
A variety of user permissions will need to be edited in order to access/dev/xpt0/dev/cdN, and /dev/passN. This is usually achieved by making the user a member of operator. Permissions to these devices have to be corrected by adding these lines to /etc/devfs.conf:
perm cd* 0660
perm xpt0 0660
perm pass* 0660

# service devfs restart

This quick guide is intended to get VirtualBox™ running on your FreeBSD device, however, the scope and scale of further configuration of your virtual machine would be unfit for a quick guide. The VirtualBox™ handbook offers a massive amount of information on how to best use and set up your FreeBSD machine. While VirtualBox™ can run on FreeBSD, it is not a supported host platform for the extension pack. Installation of the Pack will not extend the feature set