by apatheticonion · 6y ago · 0 comments
I spent several months using WSL2 but because the implementation attempts to hide virtualization behind a curtain, it was unclear where the magic successfully blended the guest with the host and where it didn't. I ended up having a lot of trouble with networking, and leaned heavily on my understanding of virtualization to debug those issues:
- Connections to Windows VPNs wouldn't work well inside the WSL guest
- Running browser automation tools like Playwright wouldn't allow you access to the browser in Windows
- The WSL2 guest can't connect to services (tcp, ports, whatever) running on the Windows host
- Trying to do something like `ssh -D 1337` from inside the WSL guest is confusing
- If you run `ssh -L 8080:localhost:8080 remote.com` using powershell, the WSL guest does not have access to port `8080`.
While incredible in that it has dynamic VM memory allocation and such, it still felt like running Linux in VirtualBox, SSHing into it and having a lot of automation to handle port forwarding - a workflow I have used in the past and isn't very revolutionary.
WSL1, while a simpler implementation that is more feature constrained, I felt that it matched my behavioural expectations (an API mapping that isn't feature complete) making it more useful. I continue to daily drive it.
Windows Terminal also made Windows competitive with other OSes that have quality terminal emulators, such as `iTerm2` or `gnome-terminal` (`hyper` is too memory heavy, though `cmder` is not too bad).
It's my understanding that MS wants to focus on Hyper-V to make VMs more like containers, but for my simple use-case/world view, I would rather the "reverse Wine" world of WSL1 to the "enhanced VM" world of Hyper V.
I will continue to use WSL1 daily and hope MS chooses to focus on this style of integration over the WSL2 style. I'd love to see features like blending `/etc/hosts`, supporting `tmpfs` and containerization (without virtualization).
If MS deprecates WSL1, I will probably move back to MacOS or Linux.
I assume you're talking about how you need to use the hosts ip rather than localhost? Because you definitely can access host ports. I'm even connecting WSL2 to an X server running on windows.
You can access the host via its IP but you can fall into application level "not localhost" security checks (Chrome for example).
You also have to know that the guest has a different IP to the host and while I can lean on my experience with virtualisation to understand and maybe find a way around the issue, it's an example of the incongruence of WSL2. What you see is definitely not what you get.
It's not a fair bar to set for most engineers, especially those who have recently entered the industry or are trying Linux (bash via WSL) for the first time.