Running VirtualBox and Hyper-V Technology Together on the Same Windows Host Demonstrated by the Example of Proxmox With Child VMs in VirtualBox

Problem

Let’s break down the stated problem from the general part to the more specific aspects. The general problem is having Hyper-V features enabled on a Windows host (because you want to use Docker for Windows or in my case WSL2) while also running virtualization using VirtualBox on the exact same machine. Without wanting to do fingerpointing: In the named constellation of software versions (AND THIS HOPEFULLY GETS FIXED SOON), this can be made runnable, but means various cascades of performance degradation and workarounds to get both up and running in parallel. But hey! For a reference and test environment, this can certainly be a viable scenario. In order to show all the performance issues, in the following example a hypervising instance (Proxmox and its child VMs) is nested inside another hypervising instance (VirtualBox). Here is what needs to be done and what this means.

Solution

First you need to switch the “Paravirtualization Interface” of your VM in VirtualBox from anything other than Hyper-V to, you name it, Hyper-V. If you don’t do that you earn weird 0x80004005 error messages. The internet is full of posts regarding this and how to fix this if you’re willing to disable all Hyper-V features. Using Hyper-V in VirtualBox is the first degradation of performance. Both do not yet cooperate that good together.

VirtualBox: VM settings to use Hyper-V

Next you need to tackle the “Processor” tab. At the time of writing you can only use 1 CPU in combination with VirtualBox. Nasty. But if the CPU is fast enogh… Also you want to make sure that the “Enable Nested VT-x/AMD-V” flag is set. If the corresponding checkbox element is disabled/grayed out you need to go to the VirtualBox installation folder, open a terminal and type:

VBoxManage modifyvm <YourVirtualMachineName> --nested-hw-virt on
VirtualBox: VM settings to enable nested virtualization

Now, the last piece of our performance cake gets eaten up if you want to run VMs inside your actual VM. Like if you run Proxmox with child VMs in VirtualBox. Then you also need to make sure that these VMs use the same virtualization technology as your Host VM. In the special case you need to disable KVM hardware virtualization. And that reeeealllly slows down the VM.

Proxmox: VM settings to disable KVM hardware virtualization

I don’t know if that is any useful for you after all the performance loss. But I had some constellations where I needed a little lab with only few machines that got provisioned with the help of Ansible and I really did not want to give up on WSL2 that is the only reason I did not throw my Windows laptop out of the window at all…

Software Versions used

  • VirtualBox: 6.1
  • Proxmox: 7.1
  • Windows: 10 (21H2)
  • WSL: 2

Leave a Comment