vagrant
vagrant copied to clipboard
Allow for use with nested virtualization in WSL2
this applies to windows 11 and i think windows 10 21H1. Regardless it's harmless to push this feature out now.
by setting the VAGRANT_WSL_NESTED_VIRTUALIZATION
environment variable, users can set up vagrant as if they were running vagrant on a standard linux box. With the latest kernel for WSL2 in windows insiders edition, nested virtualization (and even native GUI support) are available. This allows users to use libvirt/kvm. Therefore this environment variable will allow people to set up vagrant to pretend it's not on WSL.
I wrote an article here on running virtualbox inside of WSL2 using nested virtualization, and using this patch to bypass the wsl checks. https://askalice97.medium.com/running-virtualbox-inside-of-wsl2-with-nested-virtualization-bde85046fe8d
any word on this? I was able to build a wsl2 kernel that could run virtualbox
it required some combination of
CONFIG_MODULES=y
CONFIG_MODULE_SIG=n
CONFIG_SECURITY_LOADPIN=n
CONFIG_SECURITY_LOCKDOWN_LSM=n
config_module_sig kept getting set to y so I manually removed the if check so module_sig_check would always return 0 in kernel/module.c:2786
then after building the kernel i had to ensure i ran
sudo make -j $(nproc) modules_install
and once that was done just updated %userprofile%.wslconfig to use the new kernel image, installed virtualbox-6.1, and was done
I hope it will not bother: I took the liberty to up this ticket because I suppose running Vagrant inside WSL2 can work around its slowness on Windows #11853. It would tremendously improve user experience! Thanks @AskAlice for your investigations!
This would be a fantastic addition.