How to run KVM nested in WSL2 (or vmware)?

I'm trying to follow this tutorial to run KVM nested in WSL 2, but after following the directions through compiling the kernel and loading it, the test kvm-ok reports that KVM is not supported.

I've tried multiple options: enabling hyper-v, disabling it, verifying BIOS/CPU support, enabling/disabling Device Guard, other steps in some vmware docs (bcdedit /set hypervisorlaunchtype, suboptions under gpedit/DeviceGuard).

When I do disable hyper-v, set hypervisorlaunchtype off, and disable Device Guard, then I get the following options in system info, but then wsl2 fails to launch at all, saying "Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS."

system info enter image description here Any other configuration I try, sys info says that a hypervisor is running and won't show the hyper-v values, but I end up running into the initial problem of KVM not being supported in WSL2. Also if I try enabling "Virtualize Intel VT-x/EPT" in VMWare Player, that fails to launch as well.

Stepping back, ultimately what I'm trying to do is run the firecracker demo on my windows laptop. So if there's an easier way to do this then lmk.

Update

I noticed it works in VMWare Player with an Ubuntu image. Or at least, kvm-ok reports that it's enabled, /dev/kvm exists. I'd still rather use WSL2. But it's refusing to load.


Solution 1:

Top line of the screenshot, and first line of the linked article. It requires an insider dev build of Windows. Mine was running the GA version. Enrolling in the insider program and downloading latest worked.

All the settings in the screenshots are correct, and it should be bcdedit /set hypervisorlaunchtype auto.

I got 400 KVM VM's launched from WSL on my laptop in under 60s! (First 200 in under 15s).

Also note I got KVM working in VMWare Player, but the firecracker test never quite worked. It launched the VM's but they didn't do anything. Apparently VMWare is type-2 and would be slower even if it does work, so I gave up on that approach.