Problem running VirtualBox inside a container

Sandbo

Active Member
Jul 4, 2019
84
10
28
34
Hi,

I created a container using the ubuntu 18.04.1 template from Proxmox. Then I try to install virtualbox but then the service started with an error:
Code:
Nov 11 00:04:04 ubuntu-farm systemd[1]: virtualbox.service: Failed to reset devices.list: Operation not permitted
-- Subject: Unit virtualbox.service has begun start-up
-- Unit virtualbox.service has begun starting up.
Nov 11 00:04:04 ubuntu-farm virtualbox[26009]:  * Loading VirtualBox kernel modules...
Nov 11 00:04:04 ubuntu-farm virtualbox[26009]:  * No suitable module for running kernel found
Nov 11 00:04:04 ubuntu-farm virtualbox[26009]:    ...fail!
Nov 11 00:04:04 ubuntu-farm systemd[1]: virtualbox.service: Control process exited, code=exited status=1
Nov 11 00:04:04 ubuntu-farm systemd[1]: virtualbox.service: Failed with result 'exit-code'.
-- Subject: Unit virtualbox.service has failed
-- Unit virtualbox.service has failed.

Later I learnt this maybe caused by I was using an unpriviledged CT, so I used backup and restore to convert that into a priviledged CT.
However, the error remains even after I have purged and installed the container.

Any suggestions are appreciated.
 
I think I am getting closer to the actual reason, it might not have much to do with the above original guess.
First, I found that I need to install VirtualBox-6 which then supports the Linux kernel 5, the VB5.0 came with ubuntu might not be able to support it.
Second, after installing VB6, I still encounter an error but slightly different. By running rcvboxdrv setup,
Code:
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.

Then, I installed the pve headers from host, which was something like version 6.0.4.
Returning to the ubuntu CT, I checked by uname -r and see the kernel version was 5.0.18-1, so I downloaded the header from PVE website.
With these done, now I see a different error:
root@ubuntu-farm:/lib/modules# sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
depmod: WARNING: could not open /lib/modules/5.0.18-1-pve/modules.order: No such file or directory
depmod: WARNING: could not open /lib/modules/5.0.18-1-pve/modules.builtin: No such file or directory
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
depmod: WARNING: could not open /lib/modules/5.0.18-1-pve/modules.order: No such file or directory
depmod: WARNING: could not open /lib/modules/5.0.18-1-pve/modules.builtin: No such file or directory
vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
 
VirtualBox needs Kernel modules which cannot be loaded inside a container. You can try to create a new VM and expose the nested virtualization flag and try that but you will not success with Virtualbox - not even on the PVE host, because KVM and VirtualBox cannot work together.
 
VirtualBox needs Kernel modules which cannot be loaded inside a container. You can try to create a new VM and expose the nested virtualization flag and try that but you will not success with Virtualbox - not even on the PVE host, because KVM and VirtualBox cannot work together.
Actually I have tried them all, in a Windows guest and ubuntu guest. I configured the VM to have nested virtualization, and VT-x was detected by VB in the guests. However, as you said, they didn't work (not booting after all) in either, that's why I tried to use container hoping to reduce the complication, but it seems to be just impossible.

To give more background, I am actually trying to run an android OS in Proxmox, the two solutions I am considering are Bluestacks and Genymotion, and they both uses virtualbox which made it a problem. I tried Android-x86, while it runs ok, some apps kept crashing likely due to compatibility issue.
It will be great if anyone can suggest an up-to-date android OS that works well with Proxmox. Graphical performance isn't important, but I will need OS version 7 or higher.
 
That's a good suggestion, I haven't really tried that as I thought that maybe difficult as a starter (made for developers but not gamers).

I am not a gamer, but I have been lead to believe that some Android games are ARM-only or run poorly on x86 due to not having native libraries. This is also sometimes an issue with Chromebooks. It used to be the case that the ADK could emulate ARM, I haven't checked if that is still true, but it probably won't be super-fast in any case.

BTW, I use Virtualbox every day at work and while it is great for a lot of things the the support for 3D is sketchy at best. So you probably won't have a great Android gaming experience there.
 
I am not a gamer, but I have been lead to believe that some Android games are ARM-only or run poorly on x86 due to not having native libraries. This is also sometimes an issue with Chromebooks. It used to be the case that the ADK could emulate ARM, I haven't checked if that is still true, but it probably won't be super-fast in any case.

BTW, I use Virtualbox every day at work and while it is great for a lot of things the the support for 3D is sketchy at best. So you probably won't have a great Android gaming experience there.
As for gaming, yes I am aware of the performance likely will be poor. Referencing the description "gaming" I only meant the effort to set it up, which I believe (naively, never tried) the ADK is more difficult to setup comparing to readily available solutions like Genymotion. But I guess it maybe a way out given what I have tried..
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!