Back to virtualbox

I've decided to use VirtualBox again as my primary virtualisation solution on the desktop, mainly because I was unable to install Fedora in a QEMU VM.

Last time I played with VirtualBox, it had an annoying bug that has since been fixed. I also managed to screw up my Ubuntu installation by doing things in NetworkManager that I shouldn't have done.

So how did I fix it this time ?

Step 1: Installing Virtualbox
More information about this can be found on the VirtualBox wiki

Added this line to /etc/apt/sources.list

deb gutsy non-free


wget -q -O- | sudo apt-key add -

and finally:

apt-get update
apt-get install virtualbox

Step 2: Fixing networking
I have no 802.1q trunk on my laptop as I do on many other computers, but I still want to be able to interface my virtual machines with real networks. The answer: tap-devices and bridging

My main network interface is eth0, my userid is 1000 (this is the first created user on Ubuntu, so it should work for everyone). To avoid that NetworkManager gets in the way, you need to list eth0 in /etc/network/interfaces. In my case, I have to shut down NetworkManager completely because it started configuring my wireless interface.

Anyway, I configured /etc/network/interfaces by replacing is with this:

auto tap0
iface tap0 inet manual
pre-up tunctl -t tap0 -u 1000
pre-up ifconfig tap0 up
post-down tunctl -d tap0

auto br0
iface br0 inet dhcp
bridge_ports eth0 tap0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

auto eth0
iface eth0 inet manual

Step 3: Configuring udev to automatically set ownership of /dev/net/tun
By default, the permissions on /dev/net/tun are wrong (is this a bug ?!)
To set them correctly, we can modify the udev configuration.
Edit /etc/udev/rules.d/20-names.rules and change the following line:

KERNEL=="tun", NAME="net/%k"


KERNEL=="tun", NAME="net/%k", GROUP="vboxusers", MODE="0660"

This assumes that your user belongs to the group "vboxusers". If it doesn't, fix it with:

adduser <username> group

That's it. I can now use tap0 as a Host interface in VirtualBox.

I will probably make a singularity package for this because after all, who wants to do all of this manually these days ?