If you're doing sysadmin work or web development, and need to run Windows software as well or are on hardware with better Windows support, it's hard to see why you wouldn't use WSL.
To your point on total control of the emulation, not everybody needs that. If your use case means you need a real Linux OS environment, then sure, WSL isn't for you.
Well, I thought this was the case with WSL, but that WSL2 changed this, such that it's really just a full-blown VM now. Are you saying that you're still using WSL 1, or have I misunderstood the nature of WSL2?
But the deeper integration and lighter underlying OS for WSL2 is better, especially for Docker dev container usage with VSCode.
Serious question: how long does it take to spin up a VM on Windows then? Does it take seconds?
(Not disputing your other points.)
WSL1 takes about a second, and I'm pretty sure most of that is the init script that spits out network/update info.
Start VM in background at boot time and ssh in milliseconds when necessary.
> WSL doesn't run the full slew of linux processes
I don't know what linux processes are you talking about, but minimal Linux ram consumption is something like 50 MB, that's hardly noticeable.
> uses the same memory space
RAM ballooning is available in VirtualBox or Vmware for years.
> CPU utilisation is much lower than a VM
I don't think that's true. There's no inherent CPU utilization in Linux (and WSL2 is VM).
> You don't need to contend with all the fiddly configuration parameters and config of VM software, and it integrates into the Windows environment by default, again without fiddly configuration.
And that's probably the main reason why WSL is so popular. Installing VM software, creating virtual machine with proper configuration, installing guest tools, configuring it to start/stop at host OS boot/shutdown, configuring shortcuts for ssh is out of reach for most developers and power users. WSL just simplified that process. Probably could be implemented with some wrappers around VBoxManage years ago, but nobody understood the problem.
(I still agree with your overall point though.)
1. Isn't WSL2 now actually a VM too? My biggest deal breaker with WSL2 is that it moves my main Windows into now a parent VM over the Type 1 hypervisor; making everything else in my main Windows just that little bit wonkier. Worse, this information isn't as readily easily grokkable as I feel it should be. I.e. if somebody isn't comfortable installing a clean, separate VM in Virtualbox, they may be even less aware of consequences of moving their main Windows installation into a VM now.
2.Re fiddliness: Installing Ubuntu into VIrtualbox has always seemed trivially easy; and there's any number of downloadable pre-built images from safe sources. Whereas figuring out how to access Windows filesystem from WSL2 and vice versa; let alone installing GUI tools - always seemed completely opaque to me with any number of half-built, quarter-supported guides and solutions out there. And I never seem to know or guess correctly what subset of Linux functionality will or will not work, normally or differently.
Has some basic info, worth a read.
> In addition, if you have Hyper-V enabled, those latency-sensitive, high-precision applications may also have issues running in the host. This is because with virtualization enabled, the host OS also runs on top of the Hyper-V virtualization layer, just as guest operating systems do.
1. https://docs.microsoft.com/en-us/windows/wsl/faq
"The newest version of WSL uses Hyper-V architecture to enable its virtualization"
A little bit of detail on impact, but incomplete/generic.
2. https://docs.microsoft.com/en-us/windows-server/administrati...
"Hyper-V features a Type 1 hypervisor-based architecture. "
Are you sure about this? It seems unlikely that NT would change significantly depending on whether or not it is hosting a WSL2 guest. I've never noticed anything different about my Windows since using WSL2.
> Windows filesystem from WSL2 and vice versa
/mnt/C/
\\wsl.localhost\Ubuntu
They’re also doing the same for Windows 11 by default now too I believe.
> In addition, if you have Hyper-V enabled, those latency-sensitive, high-precision applications may also have issues running in the host. This is because with virtualization enabled, the host OS also runs on top of the Hyper-V virtualization layer, just as guest operating systems do.
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-w...
But yes, everything I've read and experienced indicates that:
1. WSL2 IS a VM and it necessitates installation of certain portions of Hyper-V, which as Type-1 hypervisor, means your primary windows partition is no longer bare-metal but rather now a parent virtual machine.
2. This has impact on running other Type 2 hypervisors such as VirtualBox or VMWare etc; as well as some types of performance-intensive applications and games.
https://techcommunity.microsoft.com/t5/virtualization/hyper-...
I'd say vagrant did something in that area.
Look, if you want to tune your VM exactly to your liking then use a VM. It will give you a lot more control.
Rolling your own implementation with vmware poses the exact same security and compliance risks, but its way more likely to put a spotlight on you.
Integration etc. It's just much faster and easier to pop up a terminal window straight into a shell on WSL than it is doing the same through a third party virtualization system.
>Who here is writing software which runs on Linux, yet needs to be running Windows while they do it?
Me ? Enough people that it justifies putting time into WSL and adjunct software (Windows Terminal) ?
There's certainly enough software on Windows that I need, especially on the audio/video front but also stuff like Visual Studio for my C# code. And there's UNIX software I equally need (headless vim and anything that runs on the CLI). It's a near perfect fit for me.
Sure you could write a similar script in Powershell or cmd, but its a headache I don't need.
I do, because desktop Linux is a pile of burning garbage. Do we really have to reiterate this point every time?
Never been happier in my job then the day I realized I can run my full Linux dev environment on Windows.
If you folks like spending your free time configuring Linux or virtual boxes on Windows, feel free to do so. But please don't act like "you just don't understand". I don't wanna debug the OS in my free time, I would rather go hiking.
Purely subjective. I personally think that Windows is a pile of burning garbage, YMMV obviously.
My own desktop linux experience in the past ~5 or so years has actually been better than my Windows experience. Nowadays, I use a mix of Linux and OS X with a lot more time spent on Linux[1] and I'm very happy. The only thing I consider perhaps installing Windows for some day is games, but between SteamOS and Proton, even that is very low on my priority list and if I did want to do it, I'd probably install it in a VM with GPU passthrough rather than running it directly.
I've been using Linux in various capacities (at home, not just on servers) since maybe 2006 or 2007, sometimes as my primary system, sometimes dual booting, sometimes in VirtualBox, but I've pretty much switched away from Windows entirely (last time I had a Windows install was 2015) and while I have a Macbook I use, my primary machine is a Dell XPS running Linux. I wouldn't even consider using Windows anymore, I've never been happier than when I left it behind for good.
> If you folks like spending your free time configuring Linux
I see people who don't use Linux say this, but its just not true. I spend exactly zero time configuring Linux, outside a half a day of initial setup (which, when I used Windows, is also how long I'd spend setting that up after an initial install) and much of that is largely because I can configure it to suit my particular tastes, not because I have to, outside installing a some stuff from the package manager (but again, I'd have to install the software I want on Windows too). Sure I spend more time on the commandline doing this than you might on Windows, but I prefer the commandline so it feels largely a choice rather than a necessity. I spent just as much time "fiddling" with drivers and settings on my last install of Windows as I have with my current install of Linux. I actually have a very low tolerance for dealing with shit not working.
> I don't wanna debug the OS in my free time
I've had more bugs in my last year of using Windows than I have in my previous year of using Linux. I've had to debug more Windows issues on family members laptops than I've ever had on my current Linux laptop.
I personally don't want to deal with all the live tiles and advertisements that Windows had on my mothers laptop. With Linux, I have nothing that I don't want (and if a distro installs stuff I don't want by default, its usually trivial to remove).
[1] As of about 2 years ago, prior to that the split was reversed, but that was largely due to my work at the time.
And installation was a no-brainer.
One service call, dead power supply, in 6 years.
Reckon I’ll swap in an SSD at some point because the decade old spinning rust has to be on its last legs at this point.
I don't know if Mint's arrangement will be as sensitive to it as Windows, but when we swapped an old SSD of mine into a friend's laptop the boost it was enough to quickly take it from “this thing needs to go in the bin after a meeting with a lump hammer” to being her main workhorse.
So I only tinker when I choose to, in order to customise things that are either not possible in Windows, or would require just as much (or even more) tinkering on Windows. That's not a con for Linux, if anything its a pro. Its purely optional.
The only parts where people may spend time tinkering with Linux that I'd consider a con is to get unsupported hardware to work, but that's only easier on Windows if the hardware comes with Windows drivers. If there are no good Windows drivers available, your out of luck and no amount of tinkering will likely get it working. But its been years since this has been something I needed to do on Linux (but I also do a quick search online to check that my hardware has Linux drivers before buying hardware, but those 5 minutes are hardly "tinkering").
Interestingly, I recently bought a cheap drawing tablet and it actually works better on Linux than it does on OS X when using the official drivers (but Linux default tablet drivers support basic functionality out of the box and the OSS Digimend drivers may be getting support soon to, going by the github issues).
And we still have time for hiking.
For me, when I buy a new laptop and half the drivers aren't working, that's an immediate deal breaker.
I literally won't allow myself to get into that situation again, not for love or money.
Anyone whose job also involves writing Word docs, PPT presentations, Excel spreadsheets and Visio diagrams, and communicating via Teams. The web versions are very much second-class citizens to the Windows applications.
> desktop Linux is a pile of burning garbage
That's not my experience at all. I have two nearly identical Dell XPS13 laptop. My Windows 11 laptop is considerably more unstable than the Ubuntu 21.10 one.
Now I'm in Windows most of the time, I am constantly reminded of little Win annoyances...
For instance, inability to rename an open file.
Or updates. Updates on the Ubuntu one take a few seconds, and rarely need a reboot. Updates on the Windows one take more like 20 minutes and always need a reboot, which itself takes 5 minutes or so.
That depends on whether the app that opened a file holds a lock or not. For example you can rename an open file in notepad or VSCode.
Maybe there are some apps that release the lock, but 99% of windows apps lock the filename, and its part of the "reboot after installation" dance for a lot of things.
Even macOS is starting to grate at times the last few years for similar reasons. I don’t think I like any desktop OSes these days, but running Ubuntu requires the least effort for what I do (and basically no debugging, at least for the last few years), so between it and my Mac it’s been a bit better.
I just had to forcibly uninstall wireless drivers to attempt to upgrade them (with multiple reboot cycles in between, yuck) all to attempt to fix wifi issues (following advice from Metabox’s support team) on my Windows laptop.
It didn’t work. Still garbage. Works great under Ubuntu though.
The only winning move is not to play. Throw your computer in the trash, go for a hike, and never come back.
I use a mac for my job by at home I have a Windows PC and using WSL has been great to use for my side business/projects.
I have no need for "total control" over the emulation. I much prefer linux to the windows command line and this gives me that.
A lot of people are saying this, and I guess I just have a mental block. Full-blown emulation was the only game in town for 20 years. Plus there was the 6 years I ran lots and lots of KVM's. I suppose I'm just used to it.
But if you think about the occasional user, the new user, the one who does not have such an experience it's like sky vs earth.
In VMs you have to think about a lot of things. Mounting external filesystems, bridging the network, starting and stopping the machine, GPU integration, copy/paste, guest additions, headless vs screen (what screen? do you need a VNC instance?) and so on. It's overwhelming and even dangerous (did you do "rm -rf /directory" withour remembering you mounted your whole host filesystem there? oh my..)
All this stuff is greatly simplified with a lot of Microsoft engineering time that went behind it. Linux processes are very integrated with Windows ones, you install everything with one command, it "just works", and, being target at programmers, all the developing tools stuff work seamlessly.
So yes, for a lot of users it's a huge deal
If anyone is confused about the benefits of WSL2 like the above statement, here's a video demonstrating the automatic integration of Linux+Windows. A deep link to get past the install & setup:
https://youtu.be/A0eqZujVfYU?t=5m46s
tldw: The difference is WSL2 is more tightly integrated with Windows.
E.g. the WSL2 "Linux" environment can automatically "see" Windows drives and likewise, Windows can see into Linux mount points. You can immediately type "ls /mnt" and see the C: drive of Windows without any setup. In contrast, with full VMware/VirtualBox, I'd have to type in something like:
sudo mount -t cifs -o username=administrator //mywindesktop/c\$ /mnt/win-c
Of course, entering a command isn't a big deal for technical folks but with WSL2, you don't even bother with the ceremony of it. Also, network ports are automatically set up, so Windows & Linux can communicate with each other. It's lightning fast and seamless, unlike a full vm. Another UI convenience with WSL2 is normal Ctrl+V paste works unlike a Ubuntu vm where I had to mentally pause and remember to press Shift+Ctrl+V.I stopped running a full Linux VM unless I need the extra isolation for investigating malware.
So I do most of my development on Windows, but deploy to Linux servers.
Show me a VM that allows me to access the entire host and client filesystem seamlessly without barriers.
WSL allow you to do just that and for that alone it's very useful. You can automate tasks using Windows-only software (compilers, etc.) with Linux userland tools and run both Linux and Windows software without resorting to Wine or similar translation layers that come with their own quirks and drawbacks.
Want to test whether your software package works on Linux as well? No problem, just open a terminal and compile on Linux in the same file system without having to deal with shared folders and configurations.
That's the major selling point for me.
Does that work that easily on WSL2? I thought that was mostly a WSL1 things, and thus I have not upgraded yet.
I've made an "open" alias to emulate the mac behavour, eg. you run "open fred.docx" inside WSL2 and it will open the document in word.
I've also made a "pbcopy" clone, and have a bunch of other scripts that simplify mundane tasks.
Warning opinion ahead... W98SE was better as a desktop back then. Nowadays, I prefer Linux any day. Reinstalling a Windows machine is a total nightmare, reinstalling a Linux takes me 1.5h at most.
Of course if you don't use any of these features it's not that big of a deal.
I'm happy with my windows 7 that got upgraded to win 8 that got upgraded to win 10 + wsl1. ~5 year old installation by now.
> To achieve an effective resolution of 1920x1080 you're looking at a scaling factor of 1.5, and it just doesn't work well. It also increases battery drain on a system that already has battery life issues.
But I don't know the details. hardware acceleration in browser I think is somewhat new? Last half year or so, is it now by default? You only have stereo and max HD on linux with most streaming providers. No surroundsound.
Think you got what my colloquial ass I meant.
Other than nonexistent USB drive support, it is a great desktop back then. I have many fond memories tinkering with Win98SE. I upgraded to WinME (stupid stupid move...) then went back to 98SE, then upgraded to WinXP pre-SP1 and hated it. So I went back to 98SE and remained in 98SE until WinXP SP2 came out. I felt 98SE was the last version (Perhaps 2000, again I only used it in high school) that caters on the interactivity between the people and the computer.
Now... it is like "screw you, we decide what is BEST for you and you have to suck it up". I do miss using 98SE and looking back of how it is a security nightmare because I deleted like drwatson.exe and few system files to get more space back for my Diablo II. You can imagine my reaction when it failed to boot up Windows next time. Ahh so much memories.
I began this journey before VMs on the desktop existed, and although I have used VMWare and VirtualBox, I found them cumbersome vs my preferred approach which was to make the Windows shell work like Unix (then Linux). For most of history I used Cygwin for this. You click a button and get a shell where you can run your build, utility commands etc, and you can use Windows native IDE such as IntelliJ.
I'm now a heavy WSL2 user. For me it is : Cygwin that works perfectly (since it's running a real Linux kernel and distro).
Yes, underneath it's a VM but the implementation is extremely fast and well integrated. I still get to click a button and have a shell I can run my build in. Filesystem access in both directions works. Docker even works. I no longer need to worry that yarn behaves oddly when running on Windows.
I don't (for this purpose) want "total control", I just want it to work out of the box. I also want it to keep working when my NT kernel updates, which can't always be said for VirtualBox and kin.
It's not a use case. It's linux. Fusion and Virtualbox are terrible in comparison. With WSL2(g) you get GPU acceleration, audio, X apps and whatever distro you want (and running them in parallel if you so wish). VS Code in WSL with Docker is great - much better experience than MacOS if you ask me - especially with an architecture change.
No I haven't modified its behavior beyond a few of the common preferences in the settings page.
* It broke my ability to flash my ESP32 via USB (guessing WSL2 has trouble accessing USB devices)
* It uses significantly more RAM than WSL1
* There is performance problems when working on NTFS partitions, or at least there were when I tried it: https://github.com/microsoft/WSL/issues/4401
Ofcourse, node can be configured on windows too. But then you need different docker commands/builds and docker desktop now is not free for everyone, etc.
By the way, playing around with docker build for npm app within WSL, I happened to npm install the vulnerable ua-parser-js version. Security gave me a call and we were relieved that it was within windows-wsl-docker instance. So after validation, no compromise within upper layers. This was actually an eye-opener for me that, given the threats of npm and stuff, gave some serious bonus points for jumping into docker-fan-bandwagon.
Running VM takes more hassle (but is ofcourse an option). Setting up WSL and playing around was very easy. And you don't have to think about forwarded ports and mapping file system. And running "code ." within WSL felt good - vscode poped up locally but terminal/code is actually on WSL. And you get to browse your localhost on Windows that is actually on linux. Doable on VM, but then one needs to know how to configure ssh, passwordless auth.
If you are Linux-first user, yeah, maybe you don't see value. But think about it - this is also introducing windows folks to Linux!
I highly doubt that. Nobody is playing around with WSL for fun, and it's more annoying to get into than just writing a USB and booting Linux directly. No, what WSL accomplishes is pulling people who need Linux due to its technical superiority away from Linux-proper. It's embrace-and-extend.
I'm currently wrestling with Ubuntu because IntelliJ will crash hard when opening a Java project on a WSL path.
When it doesn't crash (downgrade the jbr) it will fail to establish the RMI connection with the mvn process in Linux.
In a previous Scala project I also had to go Ubuntu native because the IntelliJ sbt plugin would run the Win10 jvm even when running in the WSL2 context.
So, yeah... there's enough differences to make it unusable for me.
Or just gone MacOS as I’ve done for 15 years. I tried out windows out of exasperation for Apple’s latest intel lemons and out of curiosity, wondering if the grass has finally grown on the other side of the wall. Nope, still the same
Lots of developers: NodeJS, Ruby, Python, Data Science folk... They typically deploy on Linux in production so often want Macs to get a POSIX-ish environment on their development environment (sadly, too few developers run Linux on their laptops).
Yes, VirtualBox is helpful. Many people use automation on top of it, too e.g. vagrant. But WSL2 arguably improves the dev experience by making it a standard, "out of the box" affair.
I see WSL2 as a way for Windows to compete better against Macs. It definitely isn't going to convince Linux fans to switch. But they can ask you to consider: you can now get a newer `bash' out of the box with Windows than macOS. Which OS works better for POSIX-stack development?
You're right on with WSL2 providing a standard usable environment though. Windows and Mac developers both need a ton of handholding to get started and WSL2 makes it a lot easier to hand them a wiki page and expect fewer 1:1 calls to tweak setups.
Linux. The one you're _actually_ using. Skip the proprietary ad company desktop and use what you're wanting to.
It works seamlessly with Docker Desktop, the MS terminal has built in support to switch between WSL 2 distros and you don't need to set up an X server to run what feels like a native Linux terminal emulator from Windows like you would if you manually ran a VM.
All of these are advantages over rolling your own VM. Around 6-8 years ago I used to run a self managed Linux VM on Windows with VMware Player and Unity mode. Current day WSL 2 is better in pretty much every way for general purpose web development and wanting to use the command line from Linux.
I started out in a virtual machine before wsl2. I want a terminal that interacts with the Windows environment (easy copy paste, mouse support in terminal, no lag of running graphical environment in terminal), so I was sshing into my virtual machine. wsl2 skips that step. I was sshing into wsl until Windows Terminal since before that I was using some Chrome SSH app which had mouse support
So answer your question: this is one Microsoft's newer efforts to lock people into Windows. This is one of the ways which are not locking people in by force; this one works by inducing complacency.
There are plenty of companies that are locked in to Windows for their workstations but have servers running on Linux. Many financial companies for instance. As a developer you have the choice of developing in Windows, in a VM or in WSL2. I personally find WSL2 the lesser evil of the three.
For example, VSCode integrates fairly seamlessly into WSL, so your app can be running in WSL but your editor in native Windows and they manage all the complexity of the host -> vm communication for you.
Finally a proper terminal in windows that makes it a worthy dev environment.
wsl2 with docker surpasses the osx experience now as well.
This goes beyond venv, virtualenv, nvm to having multiple database point releases installed, or underlying graphics processing libraries.
I like the speed and seamlessness of WSL2 but my nightmare on Windows and OSX has been the mismatch of versions which when you've 20+ projects over a few years starts to make keeping them all in running states a nightmare.
Is the WSL2 answer to VMs to use WSL2+Docker?
If you already use docker containers it's a win win.
I have a decent Windows for gaming (and to do the occasional actual Windows app development, but very rarely), so I use that for my work now (web development). The tooling is just better within WSL than natively in Windows.
I'm not sure about the actual overhead of WSL vs a full VM, but I've never experienced any problems with WSL and it's pretty seamless. A full blown VM running in VirtualBox just feels like a lot more overhead.
* I wanted to work at the Linux command line without exiting windows/rebooting
* I didn't know anything about VMs. What options are available, cost, how to set them up etc..
* zero-knowledge to installation took 5 minutes.
Backend developers at .NET shops who were issued Windows laptops by their companies.
Previously I was using Multipass with Ubuntu (on Hyper-V) but that had some weird issues annoyingly, that WSL2 just doesn’t. It’s basically seamless for me at this point.
But my use case is narrow as heck.
But if I had to choose between the too, I would favour the longevity of Cygwin.
$> wsl --install -d Ubuntu-20.04
$> wsl
$> sudo apt upgrade
$> sudo apt update
$> sudo apt install emacs
$> git clone https://github.com/.../.emacs.d.git
$> emacs --daemon
Shortcut on desktop (with VcXsrv running):C:\Windows\System32\wsl.exe bash -c "export DISPLAY=localhost:0.0 && export LIBGL_ALWAYS_INDIRECT=1 && export XCURSOR_SIZE=16 && setsid emacsclient -c"
- starts instantly
- takes as much memory as it uses
- just works
No setup, No config, no fuss. It doesn't get any easier than this.