Installing VirtualBox inside of OpenVZ - missing sources

In OpenVZ, you do not have any control over the kernel. This is because OpenVZ does not virtualize hardware, and is a "container", rather than a virtual machine on the host node. Since you will be unable to load modules into the host's kernel, this will not be possible.


Solution to running VirtualBox inside OpenVZ (in an OpenVZ container) is simple. This procedure has been tested on ProxMox VE 2.2

  1. Assuming you have control over the OpenVZ host (using your private Proxmox installation, for example)
  2. Install VirtualBox from backports on the OpenVZ host machine, version 4.0.10 (kernel modules will be built automatically):
    • echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
    • apt-get install virtualbox
    • In /etc/default/virtualbox => LOAD_VBOXDRV_MODULE=1
  3. Attach virtualbox device nodes to the container that you wish to run virtualbox in:
    • vzctl set <VEID> --devnodes vboxdrv:rw --devnodes vboxnetctl:rw --save
  4. Install VirtualBox from backports inside the container in the same way as point #1 above.
  5. Run VirtualBox inside the container. NAT networking works, Port forwarding works, Host-Only networking fails to work.