DEV Community

Fernando B ๐Ÿš€
Fernando B ๐Ÿš€

Posted on

WSL2 plus Virtual Machines on Windows 10

In this post I go over some of the issues you might be running into if you run WSL2 on windows and have used VirtualBox or VMWare for virtualization.

Plenty of people like WSL, you get a nice Linux layer inside windows and can get native linux tools and test code deployments all within one machine, it also blends nicely within windows explorer and the new windows terminal. However WSL2 uses some windows features which causes other third party virtualization programs to stop working I am talking mainly about Virtualbox and VMware.

Before you say anything about why use virtualization if you have WSL, these are really two different technologies. Personally I've built a few Windows VMs with simulators needed for my job, these are things that I can't run on linux containers. So yes, there is a need for all these technologies to coexist without having to run scripts or some cumbersome way of turning on/off one or the other.

For me the solution was to start using Hyper-V Manager for creating virtual machines.

Now if you're like me and have tons of already created virtual boxes, then you might want to look at conversion guides like this one https://www.groovypost.com/howto/migrate-virtual-box-vms-windows-10-hyper-v/. Please note migrations are always painful, now I had left my VM paused on vbox, and I don't know if that caused my failure when importing disk on hyper-v but I didn't feel like reverting the whole process to get vbox working and convert disk again. I instead just created a new Win7 VM which then I installed a few things needed for my simulator.

Enabling all Hyper-V features

WSL uses hyper-v in the background, but the full features are not enabled by default, check all options under Hyper-V, and reboot machine. After reboot launch Hyper-V Manager and voila, try creating a quick VM with an iso, if you are running into issues on boot use Generation 1 option.

image

Everyone is happy

WLS2, Virtual Machines, and Docker also works. This way you don't sacrifice one or the other.

image

Top comments (0)