
Initial Impressions of WSL 2 - lelf
https://daverupert.com/2020/05/initial-impressions-of-wsl-2/
======
tyingq
No free lunch, of course. Faster file access with WSL2 (vs WSL1), if you stay
in the Linux world. But if you point it at Windows files (/mnt/c, etc), it's
pretty slow.

WSL2 just moved the slowness from one side to the other. Accessing the Linux
FS from Windows (\\\wsl$\\) is also slow.

That said, I am a fan, and get a lot of use out of WSL1. Since I don't use the
Windows interop much, WSL2 should be a performance win for me.

~~~
muststopmyths
I'm sure I'm missing something but I don't get this problem with filesystem
access performance. It seems the obvious way to do this was to have SMB mounts
on either side and optimize the hell out of the already existing SMB
implementations on both OSes to get the performance close enough to disk.
Maybe have a dedicated virtual network interface exposed only to the VMs and
not to the LAN to avoid security issues.

It probably wouldn't get exactly up to native high-end SSD performance but I'd
wager you can get it close enough that people wouldn't care.

Meanwhile, try to do a "git status" right now in Linux in WSL2 on a sizable
repo in your /mnt/c and feel yourself slowly die inside.

It seems like a bunch of people thought it would be a great science project to
write custom kernel drivers for Linux and Windows and learn some stuff along
the way. So now they're stuck supporting two complicated software
implementations for god knows how long, because neither of them does the job
on its own.

Like I said, I'm probably missing something. I'm a network guy, so maybe to me
everything can be solved by the network stack.

(edited last line)

~~~
kevingadd
SMB to/from a linux VM is pretty slow, I've spent time trying to optimize it.
The performance hits bottlenecks in a few places including (if enabled)
transport encryption. You'll have similar problems if you try to shuffle a few
gigs across an ssh tunnel locally too (if you're sufficiently clever and
willing to wield a compiler in anger, you can disable transport encryption
entirely for a nice speed boost).

For reference I had a situation where I needed to pull/push 1-2gb blobs across
the VM boundary on a regular basis, so it ended up mattering a lot -
sub-1-minute times vs 5-10 minute copies.

~~~
jdsully
I really don’t understand why they disable the NULL cipher. If I want to take
the risk and transfer data cleartext over my LAN I don’t see why I need to
custom compile ssh/scp to do so (and miss out on security updates since its no
longer a tracked package).

I still want my auth credentials encrypted so no telnet and other older tools
are not a replacement.

------
unicornfinder
I must say WSL2 has genuinely been huge for me, to the point where I've
finally been able to ditch macOS for a desktop with a Ryzen CPU.

Honestly it's mindblowing how far Windows has come - if I were Apple I'd
genuinely be scared of losing a large proportion of power-users as Windows
becomes an increasingly viable platform for development.

~~~
k__
How does it compare to real Linux distributions? Does it have a package
manager? Is it like Debian? What are the limitations?

~~~
jessermeyer
WSL2 is a full blown emulator / virtualization solution, so it runs a real
linux kernel / distribution. The largest downside to me is no gpu passthrough
from the host.

~~~
tyingq
They say GPU passthrough is on the backlog in their post build FAQ.
[https://devblogs.microsoft.com/commandline/wsl-2-post-
build-...](https://devblogs.microsoft.com/commandline/wsl-2-post-build-faq/)

~~~
jessermeyer
I've been tracking that. Almost certainly AMD exclusive since, AFAIK, NVIDIA
prohibits GPU passthrough on their consumer cards so VPNs are forced into
purchasing 'professional' grade GPUs.

------
VWWHFSfQ
> Those pain points were solved in WSL 2 by embedding a whole first-party
> Linux VM inside Windows

Wait so now it's just a regular Linux virtual machine? I thought it was a thin
translation layer between the kernels? Kinda not as impressive now.

~~~
mehrdadn
Yeah don't get too excited, it's just a VM. The disk usage doesn't
automatically shrink with usage, and I'm not sure if RAM does either
(interested in knowing if they've done anything related to that), which were
what I found most useful about WSL1. I wish they'd instead put all their
effort from this into legitimately fixing the issues in WSL1 instead.

~~~
mtzet
The disk issue was probably going to be difficult to solve even with the WSL1
model if they wanted good IO performance. Using a proper Linux filesystem
underneath is a decent compromise IMO.

The RAM issue is a clear setback, and makes it annoying trying to do large
compile jobs on the Linux side, though it's been a while since I've tried it.
In theory it could be possible to handle coorporation between the Linux and
Windows RAM usage patterns since they're running a very heavily modified
kernel. I'd be very interrested in knowing if anything is hapenning on that
front.

~~~
gmueckl
Isn't Linux already capable of handing unused memory back to an underlying
hypervisor? I vaguely remember that MS contributed code to support that kind
of interaction with HyperV. Am I wrong?

------
alibert
Just a reminder that enabling Hyper-V (needed for WSL2) will make your
computer boot your current Windows install inside a VM too. This might makes a
slight performance impact.

And you might also encounter issues with Type 2 virtualization software such
as VirtualBox or VMWare Workstation.

(I will still stick to WSL 1 because of that).

~~~
happypants23
_Just a reminder that enabling Hyper-V (needed for WSL2) will make your
computer boot your current Windows install inside a VM too. This might makes a
slight performance impact._

That doesn't sound right. Hyper-V is a Type-1 hypervisor, so by definition the
Windows installation would not be running in its own VM (for some definition
of VM).

And its pretty much exactly the same for Qemu/KVM on Linux, where Intel VT-x
or AMD SVM hardware extensions are used to implement Type-1 virtualisation.

~~~
alibert
Unless I'm terribly wrong, when Hyper-V is enabled, it converts the current
host Windows to a "Parent partition". This is what it's described here:
[https://superuser.com/questions/836116/hyper-v-appears-to-
ru...](https://superuser.com/questions/836116/hyper-v-appears-to-runs-on-top-
of-the-host-os-so-why-is-it-considered-a-native)

------
frankohn
As a long time free software and linux supporter I am a little bit afraid of
this.

It seems like a very smart move from Microsoft. They get rid of the abysmal
performance of windows's file system and spawning new processes by using...
linux! Provide also an excellent terminal so that developers have the best
experience with command line tools, all this without leaving the convenience
of Windows!

Not surprising since they dominate the desktop market since forever being
smart at strategy.

The only weak point of WSL 2 to my point of view is that you say goodbye to
development of native Windows application because you are effectively on
Linux. It means you either setup cross-compilation which can be annoying
either you go with Visual Studio, the old MS way.

For the moment I will stay with MSYS2 plus Mingw64, they are both excellent
and provide a good experience to develop native applications on Windows. At
home I will keep using Ubuntu, of course.

For the introduction of WSL 2, I think many of the people using Mac OS X may
switch to Windows. They never fully embraced the free-software philosophy and
chose Mac OS X because of the high-quality hardware and software and the good
terminal experience with unix-like environment. They will easily switch to
Windows now.

The small group of people using Linux will probably stay on Linux because of
dislike for Microsoft practices and the fondness for free software.

Bad news for free software, good news for Microsoft shareholders!

~~~
tsar9x
My view is that WSL2 will help developers who are stuck on Windows (many
enterprises force Windows on users).

I don't think Linux will be affected as much. Moreover, Linux is better than
ever:

\- you can buy laptop with Linux from two companies: Dell and System76, soon
from Lenovo

\- performance can't be beat (especially for development, with native docker
and kvm for virtualization)

\- amazing package managers, with fwupd you can even update firmware

\- graphics stack is really good and getting better, firefox on wayland with
video decoding support, wayland with great hidpi support

\- work on chromium on wayland in progress (beta already available), we will
have electron apps with hidpi support

\- no bloatware (candy crush, 100s of processes...)

\- gaming with Proton is miles better than gaming on macOS, still behind
Windows for known reasons

Obviously if you need Adobe/Office, Linux loses many points :)

~~~
pashky
In reality enterprise users on have _zero_ chances seeing WSL2 on their PCs in
foreseeable future. Last two banks I worked for ran windows builds 1703 and
1803 respectively, more progressive of the two announced plans to update to
1903 not too long ago (yes, two first digits is year).

Oh, and WSL1 was banned, of course, on the grounds of being "too expensive and
uncertain to support". You could have a Linux VM though, with approved distro,
same as what prod machines run.

So really WSL is still confined to a small domain of switchers tired of MBP
keyboards, Linux is safe for now :)

~~~
tsar9x
You are right that enterprises are lagging 1-2 years behind current windows
build, but in many of them WSL is seen as major improvement for developers.
Fortunately I am allowed to run Linux, so I don't care :)

------
Scene_Cast2
What I haven't seen mentioned is that WSL 1 nor 2 work with the modern Machine
Learning GPU acceleration.

From what I understand, WSL 1 doesn't have proper access to GPU, and for WSL 2
/ Hyper-V, GPU pass-through isn't a thing for cards such as the 1080TI.

On Windows, Conda / Anaconda is quite buggy, and dealing with a regular python
install through the CMD command line isn't too pleasant either.

Looks like the modern macbooks don't have any CUDA-capable GPUs. What do folks
use for their ML projects? AWS?

~~~
jfkebwjsbx
+1 For graphics acceleration work it is also a problem.

I'd suggest avoiding MacBooks if you are in the ML field, or having a
dedicated desktop machine somewhere that you connect to.

------
bitwize
> When you compile the whole gotdanged planet on every file save, you do a lot
> of disk writes and stat calls on tens of thousands of files.

What kind of bizarre twisted hellscape do we live in where we just accept this
as normal -- for a web page.

------
helen___keller
For the past couple years I've developed on macOS, and the few years before
that in a different role, on windows. On both machines I ended up resorting to
a Linux VM to avoid frustrating differences between my dev environment and my
prod environment.

Windows was totally off, macOS nearly just worked but every now and then an
update would kill my dev environment and I would have to spend a day fixing
it.

WSL1 was totally insufficient, and a few months ago I would say that I
strongly prefer macOS to windows. Having toyed with WSL2, however, the speed
and seamlessness has impressed me. I haven't tried it for full time work, but
I'm getting the impression that it's superior to my current workflows with
Parallels on macOS.

That said I'd just prefer a high quality full-Linux-dev environment. Going to
just lobby for a Thinkpad instead of a MacBook on my coming machine refresh.

~~~
pkulak
I recent switched to a Linux desktop after doing the VM dance on MacOS for a
few years and I can't believe I didn't do it sooner.

~~~
fb03
I am now doing the opposite: When I need to dev for Windows or something
(usually for a contract), I spin a Win10 VM on QEMU-KVM.

If you guys have been virtualizing on VMWare or Virtualbox, try KVM. It's
blistering fast and the whole SPICE protocol is amazing. You can actually get
a usable, snappy 2+ desktop with dynamic resizing, audio redirection and USB
redirection (which is SO good i was able to test using a USB soundcard and I
got sound to play without underruns! quite a feat)

Do it!

------
alkonaut
> there was a glimmer of hope that Web Development on Windows would be viable.

I wonder if the success of WSL this will risk making some tooling that is
already less-than-stellar on windows (Git, for example) even worse when the
group that actually has to work on windows proper shrinks.

~~~
jfkebwjsbx
Microsoft has been putting a lot of resources on Git for a while, improving
and contributing back to the original project.

I expect the Windows Git will keep improving if they keep this Windows+Linux
trend.

~~~
WorldMaker
Plus, the Windows team itself uses git day-to-day now and it would be silly
for Windows developers to spin up Linux VMs to git commit on the Windows
Kernel. (Windows being source controlled in git has contributed directly and
indirectly to a lot of git performance upgrades/tweaks in the last couple of
years, including and especially to git running well natively on Windows.)

------
nickjj
Jekyll is the only thing I don't run in Docker and it's nice to see he went
from 8s to half a second.

Full builds for my site (almost 300 posts) takes like 20 full seconds, but
incremental builds when actively writing to see changes takes about 3 seconds.

So if that 3 seconds ends up being half a second or less that would be a
pretty big quality of life improvement.

For Docker related projects (Flask, Rails, Phoenix, Webpack, whatever), WSL 1
is quite speedy already since the mount is happening in the Linux VM running
Docker Desktop, not the WSL mount. I wonder if this will end up being any
faster with a WSL 2 back-end for Docker Desktop. I'll have to wait until WSL 2
hits Windows stable to try it out.

------
lioeters
> get a proper, functioning, fast Linux environment up and running on my beefy
> gaming computer

Since I didn't see it mentioned in this thread - if all one needs is Ubuntu
VMs, i.e., for common web development setup, Multipass is a simple and easy
tool:

[https://multipass.run/](https://multipass.run/)

Made by Canonical, runs on Hyper-V (or equivalent), cross-platform support. I
have not compared it with WSL 1 or 2, but it's been a smooth user experience.

------
emsy
> you do a lot of disk writes and stat calls on tens of thousands of files.

Found the root problem right there. What the fuck is going on in modern web
dev.

------
trocado
WSL2 is great but there are still some very annoying bugs, like when the host
sleeps/hibernates and the clock drifts [1], or windows detach from the x
server and can't be brought back.

[1]
[https://github.com/microsoft/WSL/issues/4114](https://github.com/microsoft/WSL/issues/4114)

------
cloudking
Big fan of WSL, get power of Windows and the full power of Linux combined. Can
easily switch between gaming and development.

~~~
eqvinox
I've been using Steam on (Debian) Linux for quite a while and haven't really
run into issues. I mostly play Dota 2 and Stellaris, which come Linux native,
but also a bunch of other stuff including quite a few Windows native /
Proton-"translated" games.

All this on AMD graphics with standard open source drivers btw, did not
install either proprietary drivers or "special" open source versions.

(Card is this in case anyone cares:)

    
    
      0c:00.0 VGA … [AMD/ATI] Baffin [Radeon RX 550 640SP / RX 560/560X] (rev cf)
      OpenGL renderer string: Radeon RX 560 Series (POLARIS11, DRM 3.36.0, 5.6.2+, LLVM 9.0.1)
      OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.2
    

Then again for lack of a Windows installation I wouldn't know if I'm losing
performance. It is however what I expect of the card's age and price segment
(mediocre in both I'd say.)

~~~
bcrosby95
I think I tried Imperator: Rome on Fedora and it didn't work. But I don't
recall. Everything else from Steam has worked for me.

With Lutris I've been able to get every other game working that I've wanted to
play - including Blizzard games, other MMOs like FFXIV, and Path of Exile. But
there definitely are some quirks and other things you might need to deal with.

Like to play FFXIV, the first play worked. The second didn't - it failed with
some network error. Eventually I figured out that if I deleted a folder the
first run created (some web cache/settings folder) it would usually work. That
included settings for storing my login information, so I wasn't able to have
the game remember that. This workaround also didn't always work. So sometimes
I would have to delete the folder, start the application. Close it down,
delete the folder, restart the application. It usually worked the first try.

Another annoyance I eventually found out: the error I was getting was the same
as what you would get when their servers were down.

------
jtdev
What are some use cases that would cause a person to choose Windows as their
primary OS, but require WSL? At what point do you just move to a *nix OS and
virtualize Windows on the rare occasion that it’s truly needed?

~~~
dijit
Developing linux software on windows is actually pretty painful.

Actually, running any linux software in general such as middleman or Jekyll is
pretty painful on Windows- I recently had a horrible time trying to get git-
crypt working for a colleague of mine who was using Windows..

There's a lot of value in being able to just run "linux" (with bash, grep,
sed, awk, gcc, python) while being able to access your normal files on a
Windows desktop.

You _can_ do this with VirtualBox but it's janky, slow, buggy and generally
awkward.

~~~
jtdev
Why not just move to Linux?

~~~
kbumsik
The GUI isn't as great as Windows and it's often buggy. Let's face it.

~~~
yulaow
Do you find the microsoft gui great? Honest question, because I have a desktop
with windows and I find its gui a clusterfuck of randomness, especially since
it seems two or three different ui "languages" are constantly fighting each
other since w8.

~~~
kbumsik
I'm not talking about the desktop UI/UX philosophy but the system itself. It
is much more stable than Linux, especially where there's ongoing chaos
regarding Wayland.

------
Tomte
X410 is an X server that works so far very well with my WSL (1).

------
fb1
Ive been using Docker Desktop with WSL2 and vscode for the past couple of
weeks and its been pretty seamless so far. The performance has been great (on
a ryzen 3600x PC and on my surface laptop 3), and was really easy to set up.
I'm forced to use a Mac at work, and have generally dual booted to linux at
home, but havent needed to so far.

------
hp_hovercraft
I have been using a VM on a Windows 10 and I have to say, it's been great! On
a dual monitor setup, I have the VM on one screen and have a windows browser
on the other, and the performance is very much close to 1:1. I don't think I
would ever need to install a dual boot system now.

------
rvz
That's great news, thinking about replacing my Ubuntu Linux install for
Windows and having WSL2 if these changes and performance improvements are
accurate. Windows Terminal looks pretty cool too, reminds me of Terminal.app
on macOS with blurred backgrounds and theming too.

Very cool blog post!

~~~
Fredej
I've done exactly that. I had some issues with WSL but WSL2 does what I need
it to do. Specifically what I need it to do is cross-compile the linux kernel
(among other things) for embedded devices. This works flawlessly.

Almost all my work has moved to WSL - the remaining bit (like UART and JTAG
access) could be done with better USB support. So I'm definitely hoping for
that!

------
BiteCode_dev
> It’s still weird to say it, but Windows Terminal is hands-down the best
> terminal on Windows.

Windows terminal is pretty good, but no, it's not yet the best terminal on
windows.

cmder is.

It has panel split, quake mode, git integration...

Now the read map of Windows Terminal is pretty convincing, so let's see how it
plays out.

~~~
Kudos
Surely the git integration is in the shell, not the terminal?

~~~
BiteCode_dev
Technically yes, but practically, cmder configures each shell it embeds
(windows cmd, powershell, cygwing bash) to work with git automatically. So for
the end user, ~=.

------
jrwr
Wow, per the block chart of how this works
[https://i.redd.it/po98dksksjx21.png](https://i.redd.it/po98dksksjx21.png)

It's using the 9P Filesystem to sync the two between systems... that's
interesting.

~~~
yjftsjthsd-h
> It's using the 9P Filesystem to sync the two between systems... that's
> interesting.

Not rare; qemu/libvirt does the same thing (well, as one option; qemu also
supports smb).

------
loulouxiv
Since this is based on Hyper-V, I guess it is a Windows 10 Professional-only
feature ? Or did they enable a trim down version of Hyper-V which can be used
on Home licenses ?

~~~
andybak
The latter

------
greggyb
Have they gotten networking transparency working to the degree that it was on
WSL1 yet? I tried an earlier preview of WSL2 and ran into a bunch of issues
here.

~~~
tapland
It's still an issue afaik. But, might be because my install is old and it
doesn't update that by itself.

------
judge2020
> Smoother web development

Last I heard networking/sharing ports didn't work, has that been fixed or is
there now a solution?

~~~
unicornfinder
Yup - all works now. If I start rails server I can access localhost:3000 from
Firefox on windows, for example.

------
Zardoz84
I would keep using native linux.

------
liminal
Bonus is that now Docker will work on Windows Home.

