I'm attempting to install VirtualBox inside of an offsite OpenVZ instance I got a good deal on. The point being to run a small Windows XP box for some kind of Windows Server.

  • Yes, it's an experiment.
  • No, it's not for production.

It seems like everything would work fine, but the installer can't find my distro's sources. My instance has Debian 6 installed. Running uname -r gives me 2.6.32-042stab061.2. I've looked all through my apt-cache for anything similar, tried installing linux-sources-2.6.32 and a variety of linux-headers, but I'm having no luck.

Does anyone know how I can get the proper sources for this instance so VirtualBox can compile itself? Thanks.

  • 1
    Openvz is not a real virtual machine. You run off the host's kernel and not your own. You can not load kernel modules into your kernel from within a container. That kernel looks like the RHEL/Centos 6 kernel provided by Openvz.
    – jordanm
    Commented Oct 23, 2012 at 6:47
  • Does that mean that this is an impossible goal? What if the container was also running CentOS 6 - would that be a match enough to get it running?
    – jocull
    Commented Oct 23, 2012 at 6:50
  • 2
    Yes, it's an impossible goal from within a container. If you can't load kernel modules, you can't run virtualbox.
    – jordanm
    Commented Oct 23, 2012 at 14:57
  • Thanks. If you want to add that as an answer I'll give you the credit for it.
    – jocull
    Commented Oct 23, 2012 at 17:44

2 Answers 2


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):
  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.
  • Thanks for the information! Unfortunately in this case I don't have any control over the OpenVZ host, just the instance :(
    – jocull
    Commented Dec 24, 2012 at 18:10
  • 1
    Sometimes, installing VirtualBox will also install a kernel inside the container. This will obviously not work and will leave dpkg in a broken state -- you will have to manually remove the kernel for it to work properly again.
    – Léo Lam
    Commented Jun 7, 2014 at 16:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .