Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.
  • Yes, I am a stingy bastard.

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.

share|improve this question
    
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 Oct 23 '12 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 Oct 23 '12 at 6:50
1  
Yes, it's an impossible goal from within a container. If you can't load kernel modules, you can't run virtualbox. –  jordanm Oct 23 '12 at 14:57
    
Thanks. If you want to add that as an answer I'll give you the credit for it. –  jocull Oct 23 '12 at 17:44

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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.
share|improve this answer
    
Thanks for the information! Unfortunately in this case I don't have any control over the OpenVZ host, just the instance :( –  jocull Dec 24 '12 at 18:10
    
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 Jun 7 at 16:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.