Windows Subsystem for Linux 2 Moving into General Availability
infoq.com
infoq.com
In WSL2, running the same command takes over 30 seconds. WSL2 is a massive hit to the seemless experience between the two operating systems with filesystem performance from Linux to Windows files orders of magnitude worse. Yes, unzipping tarballs or manipulating and stat syscalls are cheaper now on the Linux side. The downside performance loss is, however, staggering for the files I had in C:\
Don't even get me started on how long an npm install took.
One of the truly wonderous things about WSL1 was the ability to do something like this in a PowerShell window:
C:\some-code-dir\> wsl grep -R "something" | Some-PowerShell | ForEach-Item { }
Now performance across the OS boundary is so bad, I wouldn't even think of using "wsl grep" in my C drive. Or "wsl npm install" or "wsl npm run test" or any of that.
It's very depressing because WSL1 is so, so promising and is so close to feature parity. WSL2 should definitely stick around and has use cases, for Docker it's unparalleled. But for daily driver mixed OS use, WSL2 has made me very unhappy. I think I'll be deconverting my various WSL distributions because the performance hit was too much, it just was absolutely unbearable to even run simple commands in my Windows side.
WSL1 was not great in local or cross-os i/o. WSL2 is at least great in local i/o.
I mean, not hating it, but that doesn't feel all too straightforward, definitely less sonthab wsl1 :/
Though it is powering that pseudo-device by a 9p-based file server under the hood, it's not a network accessible path, it's only available to the local system.
The trade-off between WSL1 and WSL2 (and you can have both on the same system and migrate distros both directions between the two) is mostly how often and where do you expect to need to deal with the 9p file server between your operations. In both versions Windows needs to use the 9p server to access Linux files, in WSL2 Linux also needs the 9p server to access Windows files.
It's a network path listening only on "localhost".
Also, yes the current implementation backing that namespace/path is a Plan 9-based network file server, but that's an implementation detail that could change, seems to handled under the covers of the Namespace a little more directly than usual network access (including avoiding a localhost "loopback"), and probably something subject to change as WSL's needs change.
[1] https://docs.microsoft.com/en-us/windows/win32/fileio/naming...
Shame, it was really good.
Do it, free yourself (and your kernel)
Even just letters like WSL-A and WSL-B might have given a better impression.
Also, remember to disable the antivirus for your Git folder!
Given the fact that Git is used for Windows development with monster monorepository, I think that something's wrong with your setup rather than Git on Windows in general.
The supposed speed boosts of WSL2 requires having your files living directly inside of WSL2's file system.
I haven't tried WSL2 yet since I'm waiting for it to hit stable.
That was not my experience with WSL1; I was regularly running into unimplemented features. Some examples: the Z3 solver used clock_gettime for timeouts, and their specific usage was broken in WSL1 so you'd get random failures depending on how long the solve took. And don't get me started on running Chromium.
It felt like WSL1 would be running into the long tail of compatibility issues for years.
But I'll admit that I don't try to use it the way you do, I run WSL precisely so I'll never have to launch cmd.exe.
For example I use intellij on Windows but want to compile and test on the Linux machine. If it takes 30 seconds longer than wsl 1, why would I bother changing?
What is the actual point of wsl if not for the cross compatible filesystems
It's not the appdata folder right?
https://www.theverge.com/2020/4/8/21213783/microsoft-windows...
https://devblogs.microsoft.com/commandline/whats-new-for-wsl...
(Also, hints are that Microsoft is exploring adding shortcuts to \\wsl$ directly to the File Explorer left hand tree.)
https://docs.microsoft.com/en-us/windows/wsl/wsl2-faq#what-w...
Also, it seems the Intellij team is working on supporting WSL2 in some ways. Check their issue tracker.
Maybe wait for an IDE update that handles properly WSL 2?
Then there is no WSL 2 handling in your editor. VSCode remote extension works in the same way for either WSL 2, or a full-fledged Linux VM, or even a remote Linux server.
As someone who run a Linux VM side by side all times, I really don't get WSL 2.
It's the same as saying: " As a person who runs containers all the time, I really don't get Docker".
The point is VS Code handles my code hosted in WSL 2 out of the box. I don't care that I could use a VM or a remote server instead.
I just suggested that the parent commenter waits for is IDE to implement a similar integration...
VSCode made some unique design choices which enable them to support connecting to any Linux server, VM or not. In contrast, these design choices may not be possible for other IDEs. So, because WSL 2 is, effectively, a Linux VM, supporting it in editor is harder than supporting WSL 1.
As for "I really don't get" part, I wanted to say that WSL 2 sounds like a regression to me, WSL 1 makes it possible to achieve something (namely, local-ish cross-"os" net/process/file-system integration) that is entirely impossible otherwise, while WSL 2 is a nice packaged-up solution but functionally does not do more than people already get (Hyper-V).
The software engineer in me agrees with you, WSL 1 was architecturally more ambitious than version 2.
As a user, I couldn't care less. I just hope Microsoft manages to create a good ecosystem around WSL.
Then you could as well run your stuff in a regular docker container, WSL becomes redundant.
As long as your processes and files are from the wsl vm, it is extremely fast. I rather use the wsl shell, so all of my files are in the vm.
Personally I don't like VS Code, I too use IntelliJ IDEA, which will probably end up having support, but it didn't last time I tried.
On my Macbook I also use Emacs and GUI versus terminal shouldn't be an issue. I'd want Emacs from inside a WSL bash, I'd want it from the Windows GUI too. So that's going to be a headache.
[1] https://youtrack.jetbrains.com/issue/IDEA-197573?p=IDEABKL-7...
There is a Reddit sub for WSL (/r/bashonubuntuonwindows) and it's apparent that MS has PR people on it pimping each new release. Reminding these mostly new developers that Cygwin has been around (with all its problems) for years, brings on a flood of downvotes.
And now it's exactly the same with WSL2; when someone has an issue with some esoteric networking feature that is still not supported on WSL2 beta versions, I'll often remind them that VMWare Player and VirtualBox have been around for a decade and will solve their problem, while also including all sorts of nice features like shared folders, drag & drop, copy and paste integration, etc. But they don't want to hear it. They've been fed so much marketing that WSL and WSL2 are really something incredible...
I've used Linux VMs on Windows before - VMWare Workstation has been around for over a decade and has a lot of bells and whistles that make the experience tolerable, but again, the IO is too slow to share Windows and Linux apps between filesystems, so you're basically forced to develop 100% in the VM, IDE included. If you're locked to a Windows laptop because of your employee's IT rules, it's better than nothing, but not optimal, and I wonder why people are so excited for WSL2 when VMs that have more features have been around for over a decade.
I've been trying to find a non-Apple solution for a decade, and it just doesn't exist. And as Apple has been ignoring developers and MacOS itself for the last 5 years, and Linux is still riddled with the same problems it has had for 20 years, the options for developers are becoming less and less.
(This is mostly a joke, but the performance of NTFS for certain operations has always been abysmal, and having a virus scanner injecting itself into all the operations only makes it worse.)
I wonder about the bigger part of this question.
What are the higher-ups saying?
I wonder if this is like the IBM PC, which was a GOOD THING invented by a sort of an offshoot of IBM culture. Then IBM higher-ups stepped in and tried to control the platform (PS/2, OS/2, microchannel, etc)
WSL is attracting people to windows. But the endgame isn't to lose them to linux. So they have to tie it into windows more. But if they make it too slow and bloated they might lose.
an interesting situation.
You might be able to model that stuff as xattr, but then it could be problematic to mount that ext4 partition into Linux because applications might be copying files without respecting the xattrs.
Well, since Microsoft has been borrowing more and more ideas from the Linux ecosystem, it would not surprise me that a Windows 10 successor would include some kind of compatibility layers for different file systems.
We can dream...
But with that caveat in mind, Cygwin turns Windows into an acceptable Unix for command-line purposes.
I don't think it's quite as good as a development environment when you're targeting Linux though. That's where WSL (in either form) makes a lot more sense.
Also, IO performance of WSL1 wasn't exactly great either compared to native linux filesystems.
My guess is they people who put it together were under the assumption that Linux should be as simple as to implement as the old Windows Subsystem for Unix and POSIX API.
That meant that people doing disk-intensive workloads on the Linux side noticed a big slowdown compared to a native Linux system - certainly e.g. running a big test suite, or a git checkout felt really incredibly slow.
The switch to a VM flipped this relationship round - so now the formerly native / NTFS side is the second-class citizen, but you get the expected performance when putting your files on the "Linux side". For me (doing fs-intensive Rails development), this was a big win.
WSL2 will also quite happily gobble so much memory that Windows slows to a crawl (especially filling Linux's disk buffers on file copies) - that seemed like an odd default, - you just have to pop a .wslconfig in to restrict its usage.
I agree with the other posters here that the WSL1 approach seemed far more elegant, and probably the only way to "not see the joins"- with WSL2 we're worrying about filesystem boundaries _and_ memory now, probably forever. So I hope someone still working that nice seamless syscall layer for a future WSL3.
It probably won't happen anytime soon, but to me it looks pretty inevitable in the long run : because of Azure they already spend tons of engineering time on the Linux kernel nowadays, and maintaining their own proprietary kernel won't make much economic sense for long, exactly like maintaining their own browser engine.
Virtualbox, HyperV, etc will all allow you to access your Windows files on the guest OS. If that doesn't work, just set up an SMB share and map it. Why all the complication? Does clicking one button to install a distro really serve anybody? Why do you want to use the fucking awful Windows Update mechanism to update your kernel? Updating the kernel in Linux is so fast and easy...
You learn so much more about Linux by running Linux. Why are we trying to abstract that away? I think it's Microsoft's desperation to keep devs from continuing to jump to MacOS and Linux.
WSL1 was unusable as there was no way to run IntelliJ or Eclipse on Windows, and have it work on large projects sitting in the WSL filesystem - the file IO was way too slow, and the instantaneous feedback you expect from Jetbrains products just wouldn't work.
VMs on Windows would work, but again only if you were developing 100% in the Linux VM, IDE included, and just used Windows for Office and whatever else was required. But at that point, you still had to deal with all the Linux issues like ugly fonts and broken plugins, with all the problems of slow VM file IO.
Cygwin also similar to WSL1 - just wouldn't work for anything that required real Linux underneath.
Linux direct on the laptop works, but with all the same problems that have been around for 20 years and never seem to get fixed - broken multi-monitors, ACPI issues, driver support for Nvidia, video conferencing being too slow or unsupported, no MS Office, etc. I just don't have the time or motivation to spend hours every week babysitting a Linux laptop.
Macbooks are definitely the way to go, I'm just worried that my employer will balk at the cost of the new $3K 16" MBPs next upgrade cycle.
WSL1 was a great invention but Microsoft gave up on it, either because of the filesystem performance problems or because of the debuggers. https://github.com/microsoft/WSL/issues/2028 (lldb, rr, delve all affected). This looks like a dreaded case of the first 90% is easy, it's the second 90% that is hard. Imagine implementing a translator for a vast majority of Linux syscalls just to find certain flavors of ptrace are just not doable. I do not have insider knowledge to ascertain this happened but this would be my educated guess.
WSL2 is a VM like any other VM with an uncertain promise for better networking experience and even less certain promise for cross OS file performance which is much, much worse than WSL1 which was already abominable. https://github.com/microsoft/WSL/issues/4197#issuecomment-60...
It was a very nice dream, pity it didn't work out.
Because I am using an eGPU Windows 10 needs to stay as the primary OS on the laptop. I bought a little fanless machine from Aliexpress (with laptop-like hardware) for <$300 USD it'll be my home Linux server. What can one do?
I guess https://www.reddit.com/r/VFIO/comments/am10z3/success_thunde... could be a solution if I wanted to go back to Linux primary but I really badly don't want to. Constant hardware headaches were par for the course -- I was solely Linux 2004-2017. I don't want to be again. If there would be a cheap remote sysadmin service... but it doesn't exist. QuadraNet will sysop a server for $39 a month, that'd be awesome for a laptop... but I have never seen anyone doing that.
Tell me which you would rather use for node and or docker development.
- com.docker.hyperkit is nuts. I can have a single container idling in the background doing nothing, hear my laptop fans spin up, and know without checking that com.docker.hyperkit is using 200% CPU for no discernible reason. Restarting the daemon brings things back down...for a while.
At the office we use Linux, but since I've been working from home on my Mac I've gone back to Vagrant for as many projects as I can. Heavier and far less easy to orchestrate yes, but I've found I actually end up with better and more predictable performance (and far less time with my laptop doing double duty as a space heater).
I've been running this set up for over a year and the volume performance is superb.
Flask, Phoenix, Rails and Webpack driven apps are all a fantastic experience. For example Webpack takes 150ms to compile SCSS / ES6 JS diffs for large real world projects. Web server reloads on code change are effectively instant and I get microsecond response times in some Phoenix apps in development.
This is on 6 year old hardware too and the source code isn't even sitting on an SSD (but Docker Desktop is installed on an SSD).
In all cases, everything is running in Docker through Docker Deskop and I use the Docker CLI / Docker Compose in WSL as a client to connect to Docker Desktop.
It's all documented at https://nickjanetakis.com/blog/setting-up-docker-for-windows....
I have WSL1 installed, but very seldom feel the need to actually use it.
These days, there's the Windows Terminal, which is fine, surely, https://www.microsoft.com/en-us/p/windows-terminal-preview/9...
Your statement goes into both directions.
Guess why "Year of Linux Desktop" has failed to happen, and no, ChromeOS and Android aren't really GNU/Linux, the kernel is irrelevant to userspace languages and public APIs.
Not sure why you'd use or mention 'MS-DOS' since that stopped being a thing about 20 years ago, a decade before node existed.
Most people choose their laptops based on the OS, not on the pointing device.
However my T420 and X220 still perform excellently even after 9 years.
https://bbs.archlinux.org/viewtopic.php?id=204875 2015 November
https://bbs.archlinux.org/viewtopic.php?id=206032 2015 December
https://bbs.archlinux.org/viewtopic.php?id=210685 2016 March.
And these were times when I needed community help, most of the time I could get it working by pairing again or some such nonsense. It never worked reliably, in general.
Note I switched to Windows as my daily driver in 2018 January.
It seems sound is still a gigantic mess of PulseAudio and ALSA https://wiki.archlinux.org/index.php/PulseAudio
So even Ubuntu isn't necessarily a guarantee of stability.
Bluetooth has never worked.
2006 was for me the turning point where Linux was only used via VMs or some remote box.
WSL2 is just fine, I don't need to mess with VMWare any longer.
And if I am not doing Linux deployments, I can do plain Windows development, like I have done since Windows 3.0.
For the Linux desktop experience I have a surviving ASUS netbook.
This similitude baffles me. Do you mean "had to wear protective equipment, had to drive constantly between locations, we were knocked over every few seconds, and we risked drowning several times"...?
Most decent languages work great cross platform. I'm not sure what I'm supposed to be missing.
To be frank, the only think that bothers me about web dev on Windows is that the Elixir repl doesn't support "up" for editing the previous command.
Many of them have ports to Windows but it's just easier when it's all already available. Some days ago I needed to run some penetration test software and while supposedly I should be able to download the code myself and build in Windows, just installing using apt is a lot easier.
Maybe there was also some long term goals, like making Windows better platform for Linux software in general (server use).
It's made mine and my coworkers lives so much easier compared to before, so I'm certain use cases exist. Since WSL2 runs on HyperV, for some of my coworkers it's not an option, since they rely on VMware and similar for other essential work.
* Smooth set up. Don't have to install some large commercial 800MB MSI like VMware workstation, download some Linux image, go through partitioning of file system etc.
* Well integrated. I can open up a terminal and it acts as any other window in my system (meaning I don't get the window in a window effect as you get with a new VM).
* My file system is mapped automatically. No need to set up Shared Folders or whatever manually.
* Better startup perf. WSL starts in a second on my computer. Never had the same experience with full VMs. Even if I use something like alpine just starting VMware or VirtualBox takes a lot longer than starting WSL.
Saying it is like any other VM seems just incorrect. Saying it didn't work out seems even more misguided.
That may be, but the rest of your comment seems to be unrelated to the matter at hand since you merely listed some advantages of WSL2 instead of addressing the disadvantages that are causing people trouble.
Big companies that employ lots of smart people frequently seize up and become incapable of innovating because their internal parts mesh against each other and halt the whole machine. I suspect that's what happened here.
Boy, do I love unzipping tarbars! On a more serious note, it’s great that WSL has gotten much faster, although it’s a little disappointing that they threw out the older, more interesting architecture to get it and just used a VM.
I also wonder how integration changes with sockets/networking, hardware access, Windows Firewall, etc. Last I checked, relations with Windows Firewall were strained by the lack of proper support for picoprocesses.
Starting up VS Code on a machine with WSL2 immediately gives you the option to use it as the VS Code environment, it is pretty great.
* The Linux filesystem shows up in Windows as a disk even when the underlying VM is not booted, you can see an example here: https://redmondmag.com/articles/2020/04/08/~/media/ECG/redmo...
* And for me the nice one is the integration with VS Code, I just select which distro I want to work in and VS Code will start it (if it isn't running), connect to it as a remote dev environment, and be able to control it as if the VM were within VS Code. It can be done manually with VirtualBox, but VirtualBox gives me no advantages in return.
* The networking implementation makes both 127.0.0.1 which is occasionally useful for me.
Also slim CentOS image boots, well, not in one second, but something like 5 seconds. Fast enough IMO.
How does hyper-V cripple other VM software?
I just had to enable it to use a prebuilt VM I need, now I’m a little worried
Apparently they claim that as of February 19, 2020, they've "Restored the ability to run VMs through Hyper-V, at the expense of performance". https://www.virtualbox.org/wiki/Changelog-6.1
Though I remember it working at some point before that, too...
It's almost like Oracle is trying to upsell VM servers at the expense of the day-to-day operations of the once well regarded open source project they maintain?~
I don't really grok this, does this mean Hyper-V will be available on Windows 10 Home? That's the only reason I am considering buying a pro license.
The above commenter linked to a far more thorough explanation https://superuser.com/questions/1208850/why-cant-virtualbox-...
no. not together. Still a limitation of the virtualization extensions.
Although, I don’t know if both kinds of VMs can run in parallel. I recall at least doing so with VMWare in the past.
The thing is, when enabling Hyper-V on Windows, you can’t do anything without fully rebooting. On Linux I know for a fact you do not need to reboot to switch between VMs.
This is being addressed, as discussed by commenter below [1] and at [2].
[1] https://news.ycombinator.com/item?id=22874047
[2] https://blogs.vmware.com/workstation/2020/01/vmware-workstat...
You also can't nor search/modify your Linux files directly from Windows like I mentioned. The 9P server with WSL1 has been so slow as to be unusable for some directories when I try to use it. Does it feel native SSD-speed on WSL2?
As for RAM, does it really share RAM with Windows? That's great news if it does, but I don't think I've seen any VMs do this, though I've never tried it with Hyper-V... if it does, I'm guessing that's what lets it use memory ballooning?
WSL2 is the first thing to legit make me reconsider my daily-driver Fedora setup in...well, since I started using it in ~2016. I just do not think about it, it's great.
And yes the \\wsl$ is the 9P server I just tried to explain is incredibly slow compared to normal files on WSL1. I haven't tried WSL2 yet but I don't expect going through a VM would be faster.
I never used WSL1 in anger, but accessing WSL2 over the \\wsl$ is not particularly slow. It's not as fast as native, but I don't notice it. I do almost all of my access of files on the Linux image via a terminal and VSCode-over-WSL-Remote, though.
This isn't about using it "in anger". I'm not pushing it to some kind of corner case, you just need to use it for real instead of trying hello-world examples. You notice this immediately as you're dealing with nontrivial folder contents. To give you an idea, this is the speed of raw grep from inside WSL1 Ubuntu:
$ time sudo grep -ri asfadsfadf /etc
real 0m0.075s
user 0m0.016s
sys 0m0.063s
This is the speed from \\wsl$ (MSYS2): real 0m9.227s
user 0m0.078s
sys 0m0.561s
And this is the speed on the raw files from Windows (MSYS2): real 0m0.092s
user 0m0.000s
sys 0m0.046s
\\wsl$ is literally some 60x-70x slower than direct access, and it's not because I'm "using it in anger". If you don't believe me, try it yourself with any program you prefer and see if you get similar speed before you tell me I'm wrong.This is par for the course on \\wsl$. Explorer lags, too, if you try to browse a folder with a bunch of subfolders that actually have some contents. It's plain as daylight to me. Not noticing to me is like not noticing that your car suddenly goes 1mph instead of 65mph.
WSL2 is much much faster.
With WSL 1 installing an Ubuntu package or performing an upgrade was unbearably slow, with WSL 2 it feels normal.
\\wsl$ is also much faster, yes
time grep -ri asfadsfadfg /home/me/python-venvs
0.79s user
0.14s system
99% cpu
0.928 total
wsl time grep -ri asfadsfadfg /home/me/python-venvs
0.83s user
0.10s system
99% cpu
0.932 total
EDIT: cleaned up and formatted the output for better visibility, reacting to your comment.First command ran from a zsh Terminal session in WSL
Second one ran from a powershell session using the wsl "bridge" executable.
Just like what you normally use with a Hyper-V VM. A resizable VHD which grows but not shrinks, and with a size limit. Heck they even have a document on what to do when you exceed the default 256GB limit: https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes...
This of course has implications on how you setup Docker on a Windows machine, each way having pros and cons.
[0] https://blogs.vmware.com/workstation/2020/01/vmware-workstat...
[1] https://docs.microsoft.com/en-us/virtualization/api/hypervis...
Hypervisors that need more capability are going to have to do some crazy stuff to stay compatible. One option is to save and restore the whole hypervisor state whenever it runs. Another option is to be some sort of boot loader, seizing the hypervisor capability before Windows can get to it.
That'll be some tough code to debug.
In other words, you can't implement a hypervisor more advanced than Hyper-V.
If you instead want to be on the outside, with Hyper-V on the inside, then you can't just write a driver. You have to implement a boot loader. You also have to implement nested virtualization, even if you otherwise had no need to do so.
Yeah that's the difference between a type 1 and type 2 hypervisor. A type 1 runs on the bare metal, a type 2 runs via drivers underneath an existing OS. Since Hyper-V is a type 1 (like ESXi) you can't use a type 2 hypervisor on the root VM to escape being under Hyper-V you either have to do some sort of nesting or disable Hyper-V from loading and reboot.
Our hypervisor is far more demanding than ESXi, KVM, and Hyper-V. It needs to interact with low-level Intel processor details in a way that is not supported by any other hypervisor. It won't run correctly if nested inside any other hypervisor. If we supported running under another hypervisor, we would lose important functionality.
If it becomes impossible or impractical to disable Hyper-V, we'll need to do something strange and annoying. Perhaps we could load the driver very early in boot, before Hyper-V loads. Booting as an OS ("type 1", ugh) is an option too, but maintaining that and using it is a real pain. Probably we'd drop Windows host support before we did that.
I'm looking at selling my Mac and just getting an iPad to replace it - running Windows 10 + WSL + VSCode on my desktop pc is more pleasant for me to code at home with than my macbook.
Nix is probably not supported on MSYS, but YMMW. I'd love to have something like it on Windows.
The new Terminal app is great too. I've got all the same split pane stuff that I rely on in iTerm, including useful keyboard shortcuts for switching between them and resizing them. I'm very impressed.
Thanks
I switched to windows insider to get it, but WSL2 should hit GA in the next month or two.
Win10 is just a little less... elegant than OSX. But not in a way that really bothers me on a day to day basis.
I can also run Linux docker images now.
Regarding that, remember a number of years ago, prior to VMs there was a patch set for the Linux kernel porting it to user space -- so you could run Linux as a user process, which ended up functioning similar to running it in a VM. Would WSL2 be closer to this model, or is it really running Linux under a stripped down Hyper V?
Yes, that's essentially correct. You could also think of it as WINE in reverse; one big difference from cygwin is that it runs unmodified binaries rather than needing to recompile.
> prior to VMs there was a patch set for the Linux kernel porting it to user space -- so you could run Linux as a user process
User Mode Linux (UML; https://en.wikipedia.org/wiki/User-mode_Linux), which I think is still a thing, although not super popular.
> Would WSL2 be closer to this model, or is it really running Linux under a stripped down Hyper V?
Not even stripped down; it's running Hyper V. (This is one of the big problems with WSL2; if you use it, you can't use non-HyperV virtualization.)
Yeah, I compiled a version last week. It's occasionally nice for kernel devs to have an env to try out new ideas, so it more or less gets maintained.
Google's gvisor project is sort of a blend of that and WSL. A reimplementation of the linux syscall layer like WSL, but as a linux process like UML instead of as a kernel module as in WSL.
Also, Wine is really a program on top of Linux, while personalities are a core feature Windows. At a low level, the Windows kernel is agnostic wrt. the system ABI. Win32 is just one personality of the Windows kernel, just as NT used to have an OS/2 personality to run 16-bit OS/2 programs.
WSL1 shows off a character of the Windows kernel, Environment Subsystems: https://en.wikipedia.org/wiki/File:Windows_2000_architecture... (top right)
When you boot into Windows 10 normally, you are interacting with applications run by one of these subsystems.
WSL1 is now another of these subsystem.
Like wine, you are getting an API that looks just like Linux.
But, unlike wine, that Linux is a first-class citizen as far as the OS is concerned. It would be straightforward for the Windows devs to connect the Linux subsystem across to the Windows security module (see diagram). There is no analogy for that with Wine on Linux.
Kind of. But from a userland perspective, Cygwin is a (very slow and complicated) layer between the application and the kernel, whereas WSL1 really is (and importantly, feels) like just another API for the exact same kernel. That's kind of its entire advantage over Cygwin, so I wouldn't really compare them like that.
I've found no way to accomplish the above.
Code in Windows + Windows Sublime means build in WSL will be slow because cross-os i/o
Code in Linux + Windows Sublime means code search will be slow because cross-os i/o
Code in Linux + Linux Sublime + Winodws Xserver means interface is laggy because, well, Xserver
VSCode gets around this by running in a client/server model with client on Windows and Server in Linux... but then I'm stuck with an Electron based editor instead of Sublime.
"source code editor" vs full fledged IDE
It doesn't make much sense to compare the two in general imho.
Given your comments, I just installed it right now to try it out again. I like the built in terminal & git integration. Code search performance is excellent (w/ code hosted in WSL) due to this new client/server model... and there was no input lag in the editing window.
The only lag I noticed was in CTRL-P selector, but that's a small compromise given the client/server model solves the real time waster.
I think I'm going to try it out over the next few weeks :)
There's some VSCode extension that claims to mimic this but the fuzzy search seems much worse and it just doesn't quite work. Yes you can use the solargraph extension to sort of go to the def in vscode and it does all sorts of cool things, but I just never got into it.
It seems like a small thing but I just couldn't get over it, because I do it so often.
The main other difference is I much prefer the GitSavvy Sublime text extension to VSCode's built-in git handling. Particularly how I can see a summary of the commit I am making in GitSavvy whereas there doesn't seem to be a way to get all the file changes in one screen in VSC(though to be fair I didn't look around much for a way to do this, there probably is an option somewhere).
That being said if fuzzy search was working the same as in Sublime, I'd probably switch to Code.
https://docs.microsoft.com/en-us/cpp/build/reference/subsyst...
After WSL was dropped in favor of the VM approach in WSL2 it’s just a zombie name though I think?
Under WSL2, the WSL name is no longer technically accurate at all, but it’s what everyone knows it as, and the difference normally doesn’t matter, so they keep it.
The architecture descends from the Windows NT architecture:
The user mode layer of Windows NT is made up of the "Environment subsystems", which run applications written for many different types of operating systems, and the "Integral subsystem", which operates system-specific functions on behalf of environment subsystems.
Though as other users pointed out, in WSL 2, the name is inaccurate.>Because we cannot name something leading with a trademark owned by someone else. > >Think of it as Windows' Subsystem for Linux. >#ApostrophiesMatter
Just be glad we didn't call it Subsystem For Running POSIX/GNU/Linux Binaries on Windows (SFRPGLBW)
Anyway, you need to know that when this stupid Docker and/or WSL2 VM is taking up all your Windows 10 memory - not all is lost.
Using these two commands, you can force WSL2 to give back the memory it is holding prisoner!
echo 1 | sudo tee /proc/sys/vm/drop_caches
echo 1 | sudo tee /proc/sys/vm/compact_memory
Especially if the one doing the mess is the "VM" of Docker.Now that Docker Desktop is using WSL2 instead of its own VM, you can't see the bastard in Hyper-V console at all... apparently the whole WSL2 VM is not seen in Hyper-V console, even though it IS a damn VM. But it does appear in Task Manager as "Vmmem" and taking up gigabytes of your memory.
Your essentially getting the "real thing" with pretty seamless integration to the rest of windows. I'd never want to go back to WSL1.
Apparently Windows XP was going to do that, then it was Vista with its DX 10 drivers, then WinRT, then Win10,....
It takes time to replace the crap apparently.
Performance is on par with running Linux natively. I compiled my own kernel with ext4 encryption support, and it works quite well. I use it for 90% of my files. Combined with the new Windows Terminal and VSCode support for WSL, there is little friction left. (Also, to address some comments, you can view Windows files from Linux and Linux files from Windows, with some reduced performance.)
Edit: learning that WSL2 does away with the syscall-translating tech and mandates Hyper-V, the question of whether to look into this further becomes thornier!
Zsh have a long list of nice features that Bash lacks. Two of my favourites:
1. Imagine you are in a directory with file1.ext and file2.ext. You type f[TAB], it autocompletes it to file. So far, Bash and Zsh are the same. If you continue pressing [TAB], bash prints a list of files so you can complete typing the name yourself. Zsh starts cycling through filenames.
2. In Zsh, you can type for example /u/lo/b[TAB] and it automatically expands the path to /usr/local/bin. If multiple paths match the original expression, it shows a list and pressing tab cycles through the options.
Zsh is quite feature-rich, and for the most part a drop-in replacement for Bash. See this slide deck for more Zsh awesomeness:
https://www.slideshare.net/jaguardesignstudio/why-zsh-is-coo...
You can get it via the Microsoft Store and it comes with support for connecting to WSL, Powershell, and cmd.exe out of the box.
Been using terminal and 2 row powerline. It’s amazing. Hard to go back to conemu or similar in windows.
Screenshots of my terminal and set up are in my dotfiles https://github.com/nickjj/dotfiles.
It looks exactly the same as xterm on my native Linux laptop.
I've even gone as far as running i3 through WSL1 / wsltty and it worked very well with 1 monitor. I stopped using it because I have 2 monitors, but if I had 1 monitor it would have been usable for day to day development.
It supports tab, and is very configurable (thankfully there is a search box in the settings dialog!)
Can't recommend it enough.
I was a little disappointed in this. Running a VM is a lot more hassle than just running the apps natively.
Feels like a step backwards than a step forward.
The way I use it is to have all my files and project on windows FS and I code using windows software (VSCode, Eclipse) but when I build and test, I use WSL1, and I didn't feel that the performance was that bad since I have an SSD and I don't mind waiting for few more minutes to rebuild a project.
But the most important thing for me was that I didn't care about managing another file system. All my files are still on windows where I used to keep them, file sync and backups are working as expected, and I easily browse and edit these files on the Windows side.
For docker, I installed docker on Windows and hooked Docker CLI on WSL1 to it using some configurations. and I was happy with it.
The question is, for the way I use WSL1, will WSL2 be an improvement or a drawback for me? and should someone like me switch to WSL2?
There is one thing though that no one talks about.. the fonts!!! The font smoothing is awful on Windows... will this ever change?
The new terminal looks alright, the default font is nice; but most other programs I like look awful in Windows: Sublime Text, VSCode, gVIM, ... I just can't find a monospace font that looks "thick" enough for readability and have smooth edges -- especially with dark text on light background.
This was why I have finally switched away from developing on windows, there's something about the VS remote code server setup that will spawn tons of processes and eventually slow WSL to a crawl. Possibly my fault, I haven't gone through all my extensions and settings carefully, but also not an issue when running VS code on unix without the server.
WSL had a limitation that it couldn't display such characters when I accessed a Linux parition through Samba. I know there is a Samba workaround for name mangling, but I prefer to access the actual filenames as created by org-mode.
Edit: Samba was running in an Alpine VM that mounted a ZFS partition. The network folder was mounted through Windows.
Unfortunately if you install Windows from scratch, without going through Bootcamp to install it side by side with MacOS, Hyper-V support is disabled.
This means that I cannot use WSL2. Or Windows, since without a working Linux environment it's useless to me and I don't want to invest in WSL v1. Might as well go for Ubuntu 20.04.
This is the first time I hear of rEFInd.
https://dea.nbird.com.au/2017/02/24/enabling-vt-x-on-mac-boo...
https://github.com/docker/for-mac/issues/77
https://docs.docker.com/docker-for-mac/osxfs/#performance-is...
With OSX, the terminal experience is great, no need for a "WSL" over there!
https://github.com/ish-app/ish
https://github.com/linux-noah/noah
They have varying stages of support for Linux syscalls.
[1] https://docs.microsoft.com/en-us/windows/wsl/wsl2-faq#does-w...
Regarding hyper-v they are only making necessary component needed for wsl2 available.
(I tried rewording this question a few times to not sound snarky, but failed.)
Java and .NET Web development has been perfectly fine the last decades.
Also node is not going to stop downloading the whole Internet regardless of the host OS.
WSL2 in particular lets me use a BTRFS partition and expose it to windows with a lot less awkwardness than the VM I had before.
Another clever move from Microsoft and the Windows Teams.
However there is a fundamental issue - Microsoft is treating this as a toy project. The number 1 problem is that the file system inside an Ubuntu shell/wsl2-container is sitting inside a hidden file system.
It is is not exposed to the rest of windows and neither to backup tools like Dropbox, etc. So you have a huge chance of losing important documents inside a WSL2 container. Now, you can "Cd /c/Documents" and do your work - but this filesystem is unimaginably slow. Not sure if it is because of file mounts, etc. The performance is incredibly bad.
If there are WSL2 devs here - please make the working container filesystem as a first class directory inside the rest of windows. I'll live with performance issues for a while...but this is a blocker.
You can go to \\wsl$\ and it shows each wsl install as a network drive.
In linux, you just have a separate /home partition . You can have a dozen operating systems, merrily using the same home partition. you can trash your OS, but your home directory doesnt get trashed.
i have a pending request to offer the concept of a "home directory". the filesystem on which i work inside wsl2 should not be opaque to the rest of the operating system.
Took me several reads to figure out that "tarbars" was a typo for "tarballs". Thought I'd missed some new archive format.
\\wsl$\Ubuntu-18.04\home\username
Though Wine is quite good.
I've always been suspicious of WSL because it follows a narrative that benefits Microsoft - that Linux is primarily a command-line/server environment, and the graphical and audio applications for Linux are not worthwhile. It doesn't have to be like this. WSL1 was based on an Android environment for Windows Phone called Project Astoria, which did support graphics.
I think the only real way to fix this is to change the economic incentives by increasing desktop Linux market share, which is a long and uphill battle.
More z/OS and less UNIX.
So not really a reason to cheer what would be yet another pyrrhic victory in the desktop/mobile space.
I certainly neither said, implied, or agreed with that concept, no.
It has made my life so easier. All the Linux stuff + development work gets done inside Windows Terminal + WSL2 + NeoVim, and I still get to keep Windows for Gaming, Designing, Office work, other random programs etc.
Congrats to WSL2 team, they introduced this pattern to a much wider audience.
This way, it feels like I'm on Linux the whole time with a Windows themed desktop, great support for games and no hardware issues. This isn't about ideological purity for me. If everything works, I'm happy.
Why? Because GPU driver compatibility is still so bad on Linux that I can't get any of the popular distros to work properly on my setup (laptop with hybrid Intel/nVidia GPU setup, thunderbolt dock, external display with different scaling than laptop display).
And yes, if I spend a weekend fiddling with Nouveau drivers I might get it to run somewhat decently, but really I don't want to spend that time on my work setup. Window + WSL works out of the box, so I'll use that.
I've got Nvidia too and Nouveau works only well enough to download the proprietary drivers
Mixing business and gaming on the same machine caused problems for me even when I was fully on Windows, so I've always kept separate machines for that.
In the end, I just found that I am more productive with Windows. On Linux, I really hated driver compatibility issues (happens quite often on laptops), core programs are not so stable (KDE window manager) and skype sucked on Linux.
Also, I could not game on Linux so that sucked even more. On Windows I have steam with 0 worries about registry and dll hacking with WINE.