102 points · by todsacerdoti · 6y ago · 98 comments
I never thought I would see the day I prefer Windows to OSX AND Linux for a development environment, but that day has come.
I am ASTOUNDED by how well WSL2 works, especially when integrated with VSCode.
For a much better terminal experience, I recommend Windows Terminal. Easy to configure, works great.
You get a lot of that on Mac though (well, less so on the gaming front, but Macs have some apps that aren't on Windows too). But that's "real" Linux, so you don't have to spend time installing GNU tooling or fighting with brew.
Dual booting can get annoying, because you have to, well, reboot.
You don't have to worry about hardware. Linux has come a long way, but there's still the random peripherical that doesn't work, or some where the configuration software is Windows only. It's pretty easy to avoid hardware that won't work with Linux, but in this world you don't even have to worry about that. Especially relevant in the desktop space where you have to look at every component.
WSL2 also has some interesting benefits, like being able to install a couple of different distros, or wipe out and start over in a few seconds if you screw things up. It's kind of the docker experience without docker.
In the corporate world, it also means not having to convince your employer to get a Linux install they'll support. The company I work for only allows Windows or Macs. Sure, I've worked at big companies where after some back and forth with IT we could get Linux on the PC machines, but it's nice not even have to go through the hoops.
There's some drawbacks: interop between the WSL2 file system and the Windows one works fantastic, but it's FREAKISHLY SLOW. If you're trying to git clone a big repo or npm install a big library and you're crossing boundaries between the two system, you're not going to be happy (as long as you stay within the WSL world you're fine though).
GUI apps are an issue. It's pretty easy to get most apps working using a Windows compatible X Server, but hardware acceleration is an issue. It looks like it might be possible to get working, but I sure as hell haven't been able to. The team is working on an official way to run GUI apps without going the X Server forwarding path, but it's not there yet. For now it works fine for simple things, like terminals and text editors, but trying to use Google Maps in Firefox is simply not useable (but it does work!).
I'm one of those weird people who actually likes Windows, and for 99% of my development use cases, Windows + WSL2 let's me do everything I need with zero compromise, and without having to reboot all the time. I can have a Windows-only game running with my Linux terminal open to do some development while I'm waiting for a group in my favorite MMO. Docker + WSL2 is great too.
I would like to emphasize the fact that I can get a windows machine and run WSL on it, and not get a bunch of eye-rolls from my IT director.
Additionally: Linux laptops are pretty OK, but Windows power profiles and power management make battery life on a windows machine MUCH better.
Does that include all the phone-home stuff and ads as well?
I only run Windows (10) on a work laptop, and I'm guessing it's the 'Enterprise' edition, so all of that is not present. I've heard that there's a lot of intrusive garbage in the home-oriented editions: is that accurate?
(I sysadmin, so dog food Linux on my workstation.)
Edit: why the downvotes? As someone who runs an Helpdesk/IT-managed Windows laptop I have no idea what the state of the consumer Windows sphere is. The parent lists many good things: are there any bad things worth mentioning?
So instead I can run IntelliJ under WSL2? Nope, not until there's a performant X server. Ok, so under Windows, pointed at my Linux filesystem? Wouldn't there be dos2unix file format issues there? And it sounds like it's painfully slow for now until they fix the networking.
But this is somehow better than having to "brew install" a few things? I'm very eager to try this out, but I think WSL3 might be a better starting point.
Incompatible hardware/software are definitely a real problem that probably affect a large enough percentage of people unfortunately.
Do they expose hardware perf counters in the VM? I.e. can you run instruction profilers?
Quite surprisingly, VcXsrv works very well as well out of the box. No additional configuration to what's mentioned in the article has been needed. Running a full GUI is a bit over the top but being able to run Linux GUI apps is sometimes a must.
This setup is all I've been asking for a long time and is worth trying to anyone who devs on Linux but wants to run windows as everyday OS.
All I've got trying to run docker was:
System has not been booted with systemd as init system (PID 1). Can't operate.
And it is right, WSL2 uses it's own init system that basically launches bash.There are some oddness with things like `--net=host` as the daemon is running in effectively another VM, but for standard Docker workflows it's been fine.
sudo service docker start
.. voila
A difference between WSL and standard Linux is that is doesn't have a startup service manager, so you need to start services manually.
It will be a big step forward from the various X server options & is looking very promising.
Personally I am really liking WSL2- it has replaced an always on Linux VM for me (well, it is an always on Linux VM for me).
Here's a question I've been dying to ask someone who admits this is just a VM: What makes it better than running VirtualBox or VMWare Workstation, and having a nice GUI to control the various elements of the virtualization settings?
- easy integration with the Windows filesystem (it's automounted into the WSL env)
- Using VS Code to work with files in the WSL2 env. works out of the box (just type `code .` in a WSL windows)
- It's very quick to spin up new WSL2 instances. you can just use `--import` and it'll bring in a tarball to create your new instance. You can even export a Docker image and use that as a WSL instance base filesystem which is handy.
- Docker for Windows works pretty well for most usecases and you get one shared Docker instance across all your WSL setups.
Sure I could do all that with discrete managed VMs but this is easier
https://docs.microsoft.com/en-us/windows/wsl/compare-version...
A VM has always felt a little cumbersome, even with all of the integrations working correctly.
One interesting thing is that if you have WSL2 turned on, then Windows runs virtualized as well -- it's just the 'root partition' under Hyper-V.
When it comes to user friendliness and things "just working", it's easily the worst choice you could make.
I completely agree on WSL1 but once I switched to WSL2 I haven't seen anything that doesn't "just work".
I'm just not seeing a good reason to stay Linux-native and I've been Linux-native for 10+ years now.
Apparently the integration Microsoft is working on uses RDP but with some magic or whatever to avoid tcp overhead? Maybe shared memory?
I hope it turns out performant cause the x11 method is like a party trick at best.
https://www.reddit.com/r/bashonubuntuonwindows/comments/gyk8...
The WSL2 Linux VM runs on Hyper-V, BESIDE windows, not on top of it. So the VM is fast and i/o is fast.
VSCode has a WSL2 plugin which enables it to operate in client/server mode with server running in Linux and client on Windows (seamless to end user). The setup works really well.
I've tried the GUI approach described in this post but there's a noticeable latency in GUI apps running in the VM. Microsoft has announced a new approach they're trying out so let's see how that plays out.
I'm not sure what he's trying to say here. unix based operating systems are gaining market share, so microsoft is adding support to stay relevant? The main problem is that most of the growth is coming from mobile/embedded devices, where the platform is so walled off to the user that it really doesn't matter whether the kernel is unix-like or not.
Well...
https://docs.microsoft.com/en-us/windows/wsl/install-win10#s...
If you can't just use the latest Windows 10 version, you really need to pay attention to version, build and minor-build.
This isn't mentioned in the blog post but if you use VcXsrv you can have it start up automatically by putting its config in your start up folder.
That's what I've been doing here for the last year or so: https://github.com/nickjj/dotfiles/blob/master/c/Users/Nick/...
If anyone prefers video about 6 months ago I recorded https://www.youtube.com/watch?v=idW-an99TAM which is about a 30 minute drive by of setting up WSL 2 + Docker + VcXsrv and a bunch of other tools that are handy on Windows for web development.
The only issue is with WSL I'm limited to console apps, so if I want to build an OpenGL or Vulkan or GUI project, I have to use Visual Studio or VSCode if I want a good development experience, and even then, it's not quite as comfy.
I can only hope that with better GUI support comes some kind of GPU passthrough, but a woman can only hope.
Until the native WSL 2 GUI support launches you can use some workarounds like Xpra or X2Go - see https://dev.to/derkoe/development-environment-in-wsl2-137l
Yeah, totally considering how hostile MS gaming division is towards Linux gaming and Vulkan adoption.