Environment

I replaced WSL with a full Linux VM, and here’s why it’s actually better

I replaced WSL with a full Linux VM, and here’s why it's actually better

Windows Subsystem for Linux, or WSL, has been an incredibly welcome addition to Windows for those who enjoy developing and tinkering with Linux distributions. The lightweight, easy-to-setup nature of these instances is perfect for anyone looking to run Linux tools without needing to leave their primary OS. Once I started to use non-native packages and stepped outside of basic command-line tasks, I began to miss what a full virtual machine had to offer. A little while ago, I decided to make the switch back to Linux VMs, and I haven’t looked back since.
A VM is a complete sandbox
An isolated environment can be better
One of the main reasons I feel more comfortable using a VM is that I can completely isolate it from my host system if I choose, which isn’t an option when using WSL. In a VM, everything is fully contained with its own storage, kernel, and OS configuration. WSL shares the host kernel, which not only means that Linux-specific kernel tweaks aren’t possible, but also that you can’t take snapshots if something goes awry, at least not easily. You also can’t easily clone a WSL instance like you could a VM, which is a trivial task with most hypervisors.
Networking and hardware passthrough is clunky
It’s pretty seamless with VMs
If you’ve ever tried to tinker with networking in WSL beyond what’s happening on your machine, you know it’s weird to say the least. For one thing, WSL instances get a new IP each time they start, which isn’t a huge issue if you never plan to turn it off, but if your PC ever turns off, you’ll need to reconfigure. Additionally, the networking tools Linux provides are a bit weird; things like ufw, iptables and tcpdump don’t really behave they way they ought to because WSL runs on its own NAT layer.
Additionally, hardware passthrough in WSL leaves a lot to be desired. There’s some support for GPU and USB passthrough, but it’s really restrictive on what devices it will work with. There’s a hacky way to forward USB devices to WSL2, but your mileage may vary.
In comparison to VMs, there’s just no contest here. Native USB passthrough is something I took for granted when I started using WSL for more than just basic command-line tasks, and it’s pretty much plug and play with VMs. GPUs can be used for more than just compute, and they can be passed directly to VMs if the hypervisor supports it. On the networking front, VMs can be handled as if they’re a true host, not just an extension of your current machine. They can have a static IP or even grab one via DHCP, and testing things like VPNs or firewalls behave pretty much 1:1 with bare metal counterparts.
You can be way more specific with VM setup
Just the way you need it
With a WSL instance, resource allocation is handled automatically, which is both a blessing and a curse. I have more than enough memory and cores to handle multiple WSL instances, but not being able to specify exactly how many CPU cores, RAM, and storage I want a specific instance to have is a bit of a drag.
While I can’t change it on the fly, I can still set aside a very specific amount of resources for a VM, and then change it again later, whereas if I leave a WSL instance running while I do other things on my host machine, there’s a chance they’ll begin to compete for resources, ultimately slowing down whatever I’m trying to do.
WSL lacks a desktop environment
Can be a good safety net for learners
While I personally don’t have a problem navigating a command-line, there are things that are just a lot less tedious with a GUI interface. I’ll get a bit of flak for this from diehards, but sometimes I just want to click and drag, or open a directory and start a Terminal instance from there, without needing to type 20+ characters to change my directory.
For those learning Linux it’s also much easier to have the desktop environment as a sort of safety net. If you’ve moved a file somewhere you shouldn’t, or created a file/directory with the wrong name, it can be difficult to visualize where and how to fix that, and a GUI can provide an alternative way to get things back on track. A full desktop environment also affords you the ability to use things like GIMP or LibreOffice, which isn’t possible through WSL.
WSL is still excellent for what it is