LXD VM Nested Virtualization

I have a LXD VM for Windows 11 that is up and running just fine. I have enabled virtualization on my Ubuntu 22.04 LXD Intel host with:

sudo modprobe kvm_intel nested=1

I have verified that virtualization is enabled:

cat /sys/module/kvm_intel/parameters/nested

On my Windows 11 LXD VM I have installed wsl from an administrator powershell prompt:

wsl --install

This appears to complete without error. Unfortunately, when I reboot the Win11 LXD VM, I get a blue screen prompting me to do a repair and I can’t seem to get past it.

Any ideas? This VM is for dev testing. I do not run any bare metal windows in my lab and I wanted wsl2 for testing.

1 Like

I’ve also run into this on occasion but then I’ve also had it work on some other platforms.
Sadly Windows isn’t exactly providing a ton of logs on what’s going on…

I’ve been running nested VMs on Linux though and that’s worked fine, so it suggests that the LXD/QEMU setup should be functional…

So, LXD VMs should allow nesting if I have QEMU Nested support enabled on the host?

Yep, we do CPU flag passthrough by default (which is the main thing you need) and we don’t filter any of those flags (which is how other virtualization solution prevent nested virt).

After much testing, I was able to do nested virtualization on a QEMU Windows 11 guest. My test was installing WSL2 inside of the guest. The Windows 11 LXD-VM on the same host corrupted upon the reboot after installing WSL2. So, something is different and I am not sure what it is.

I am also experiencing the same phenomenon.

In addition to this case in my case, I have also tried “windows 11 on libvirt” and confirmed that it crashes as well and displays a blue screen!

I am assuming that if the guest OS is windows, the VM nesting settings are not being reflected correctly, but what would do you think?

@y-hashida I have addressed the Windows 11 LXD question in two of my videos “Windows 11 LXD Virtual Machine” and “More Windows 11 LXD Virtual Machine” on my YouTube channel https://youtube.com/@scottibyte.