Can VirtualBox and KVM run alongside each other?
Solution 1
Your only real option is a matter of order:
If you start and open the VirtualBox machine, wait for it to finish booting and then start the KVM machine (from virt-manager or virsh) it should work correctly. Booting the machines in the opposite order will not work.
Loading and unloading the kvm
and kvm_intel
modules will satisfy VirtualBox's requirements. A smoother, script-based method for this can be found here.
EDIT: this solution (boot order) no longer seems to work for me, since upgrading to Ubuntu 13.10. YMMV.
Solution 2
You can't make them work together. They both need access to the CPU's virtualization features, but that's not designed to be used by more than one hypervisor at once.
You could try disabling Virtualbox's VT-X support so it doesn't try to use hardware virtualization. Edit the virtual machine's settings, in the system tab find the "enable vt-x/amd-v" tick box and unmark it. I don't promise it will work, and even if it does, it will use software virtualization for virtualbox so your VMs will be slower.
If at all possible, I strongly recommend you choose just one hypervisor and use it for all your VMs.
Solution 3
As already said in answers above,
In Linux environment installing Qemu/KVM, VMware workstation and Virtualbox ON THE SAME HYPERVISOR is possible.
So the problem IS NOT in INSTALLATION
Once all of them are installed you have this :
lsmod | egrep 'vm[nmw]|vbox|kvm'
vboxpci 28672 0
vboxnetadp 28672 0
vboxnetflt 32768 0
vboxdrv 483328 3 vboxnetadp,vboxnetflt,vboxpci
vmnet 61440 13
vmw_vsock_vmci_transport 32768 0
vmw_vmci 81920 1 vmw_vsock_vmci_transport
vmmon 102400 0
vsock 40960 1 vmw_vsock_vmci_transport
kvm_amd 94208 9
kvm 700416 1 kvm_amd
irqbypass 16384 1 kvm
===
All the lines including kvm --> used by Qemu/KVM
All the lines including vbox --> used by VirtualBox
The others by VMware (look in :
ll /lib/vmware/modules/source/
total 5460
-rw-r--r--. 1 root root 870400 Mar 30 20:19 vmblock.tar
-rw-r--r--. 1 root root 1341440 Mar 30 20:20 vmci.tar
-rw-r--r--. 1 root root 1443840 Mar 30 20:20 vmmon.tar
-rw-r--r--. 1 root root 768000 Mar 30 20:20 vmnet.tar
-rw-r--r--. 1 root root 1136640 Mar 30 20:20 vsock.tar
for source: module compiled at installation)
=======
AND NOW THE USAGE OF THIS :
AS SAID by roadmr (the second answer above) Only one can use Intel-VT or AMD-V at a moment If you start some usage of Qemu/KVM for a 64bits Virtual Machine, then VirtualBox at the same time CANNOT make running a 64 bits machine, because VirtualBox does REQUIRES HW acceleration for 64 bits VM.
To give some light about answer by David Baird above:
With AMD Atlon X2 or X4, or AMD FX 8-core, or with Intel Core I5 or I7,(machines where I could make a try),
==> VirtualBox 5.2.10
is not able to make running at the same time on Linux, after KVM has locked Intel-VT or AMD-V access, and extra 64 bits Virtual Machine !!!
while
==> VMware player or workstation 14.1
will be, PROVIDED you uncheck Intel-VT or AMD-V usage !!!
Now Forget Qemu/KVM, and I tried to start a 64 bit VM in VirtualBox, and after a secaond 64 bit VM at the same time in VMware, or in the reverse order:
ONLY the first one is able to run with a default configuration!!!!
But Disabling Hardware acceleration , is it possible as suggested in answer by MiGrieves ???
In VirtualBox-5.1:
VM properties --> System --> Acceleration: disabling HW accel. is impossible for 64 bits VM machine:
For example if you unckeck "Hardware Acceleration", in the configuration menu of a given 64bits VM machine, the VirtualBox configurator protests, and re-enable automatically "Hardware Acceleration".(check it by going back in the same menu !!)
In VMware 14 :
Virtual Machine --> Hardware:Processor --> you can unchek Virtualization Engine
AND THEN your 64bits VM can start, even if your Intel-VT or AMD-V CPU feature is locked by KVM or VirtualBox
So VMware in last today release is able to emulate Ring 0 instruction for 64 bits Virtual machines, as it was doing it for 32bits machine, more than twenty years ago now !!!! And honestly it's difficult to notice the difference of performance for 64 bit VM VMware machine running with or without Hardware acceleration, without a benchmark !
===
Now we can expect that some days, kvm and VirtualBox, will be able too to emulate Ring 0 CPU instructions for 64 bits machine !!!!!
Solution 4
VirtualBox and KVM will not run at the same time. However! VMWare Workstation will run at the same time as either of these, and that's interesting.
On an Intel Sandy Bridge Xeon, VMWare Workstation and KVM will run at the same time. VMWare and VirtualBox will run at the same time. It's just that VirtualBox and KVM will not run at the same time.
If VMWare is achieving this, then there must be a way that KVM and VirtualBox can also. Maybe VMWare has access to proprietary Intel specs that make this possible? Wish I could try this on AMD, to see if it's just an Intel thing.
Related videos on Youtube
Comments
-
Maythux over 1 year
I have a KVM virtual instance running on my machine. I installed VirtualBox; but, when I tried to start the VirtualBox VM machine, I got the following error:
VERR_VMX_IN_VMX_ROOT_MODE
I searched based on this error message and the problem is that KVM is already installed.
I know that I can switch between them by removing some modules then use VirtualBox. However, my question is how to make them run simultaneously?
-
Maythux over 10 yearsEven that this will not solve my problem. I'll try it.. +1
-
MiGrieves over 3 years@erwan-l , I use this since I cannot comment yours: The VBox 5.1 can disable h/w acceleration, but won't run 6-bit guests, as you said. However, it allows 32-bit guests, with some limitations in mem. and cpu.
-
skeetastax over 3 yearsDoesn't appear to be Intel only issue - I got issues trying to run KVM and VirtualBox on AMD Ryzen 1950X :(