182 points · by CoolCold · 4y ago · 253 comments
That said I will agree with other comments here, the version numbering is weird. I can't even tell _how_ to tell what version of WSL I have. Versioning is still an unsolved problem even for tech giants I observe.
With Mac OS I still like the Mac terminal more than the Windows terminal and just SSH into Linux boxes.
Still, for me, nothing beats a Linux desktop with i3wm on it.
If you need to keep doing this, I warmly recommend Mosh instead. https://mosh.org/
Mosh backed up with either tmux or screen is handy indeed.
(WSL2 is a lightweight VM in a traditional VM sense.)
Virtualization is so efficient nowadays that it's much performant to go that route vs porting where often there will be difficult to debug performance regressions and bugs. So what WSL provides instead is much tighter integration between that linux VM and windows (including performant filesystem access, etc.).
Soon people will be forced to use it in particular contexts, let's say for the DRM Subsystem For Windows Subsystem For Linux. And since you need the DRM Subsystem For Windows Subsystem For Linux to run those few pieces of crucial software, WSL becomes your daily driver. Then MS starts shipping their own downstream distro with even more extensions that hook into Windows...
That’s what WSL is like
wsl --version
... if you're on a new enough version. -_-Well, this is Microsoft we're talking about. Think about Windows versions. Xbox versions. Or how to figure out where 64bit and 32bit goes on Windows [1]
It's in their DNA :)
[1] http://piers7.blogspot.com/2010/07/64-bit-explained.html
Why does that happen? It feels like the only reason WSL exists in the first place is to help sidestep the monumental bureaucracy in fortune 100 companies that see Linux as nothing more than a risk. Its a methodone for companies that want devops, but are too calcified and encumbered to really do much besides lip service.
E.g. try to find a sane and maintainable method for allowing non-root users to install Postgres. podman/Docker work for something like that, but what about VSCode? People can download a tarball, but I think the sandbox requires a setUID for some kind of security something.
You can give people sudo rules, but sudo whitelisting is prone to ways to escape from the command and open a shell.
WSL works because the company can control the hypervisor host strictly, and let the guest VM be more lax. The same would be true of a Linux VM inside a Linux host, but WSL lets the Windows people use Windows and the Linux people use Linux.
It's not an unsolvable issue, but I can see why companies are interested in having a single device management suite that allows end users to use Windows or Linux (ish).
The easiest way would be usermode package managers like Nix, Guix, or Homebrew.
> People can download a tarball, but I think the sandbox requires a setUID for some kind of security something.
I'm not sure what you mean, but you don't need root to use user namespaces (sandboxing) on any remotely recent Linux kernel.
> Most distros have a poor security model for allowing partially-trusted users. [...] You can give people sudo rules, but sudo whitelisting is prone to ways to escape from the command and open a shell.
The same product my employer just rolled out for managing this on Windows has a native Linux version. I assume it must have competitors.
> WSL lets the Windows people use Windows and the Linux people use Linux
No it does not. It lets the Windows people use Windows and the Linux people still have to use Windows, and a fucked up Linux VM that can't access their hardware, has to contend with Windows broken-ass networking stack, operates extemely slowly on files that are stored where the corporation wants people to store source code (i.e., on the Windows side), etc.
> WSL works because the company can control the hypervisor host strictly, and let the guest VM be more lax.
Why? Don't all of the material issues w/r/t endpoint management (data exfiltration, update management, anti-virus, idk) recur inside the VM anyway?
I.e. https://www.manageengine.com/mobile-device-management/what-i... lists ChromeOS, but not "Linux" systems, while ManageEngine of the leading products as far as I know.
"not possible to access wsl from session 0 (which is where the Windows OpenSSH server run)" [1,2]
is now a deal breaker for me to upgrade to whatever they called 1.0.0 version or released over Windows Store.The old version (non-Store version) used to work, and now the upgraded / non-Preview version doesn't. I don't know how they dare remove that preview tag.
[1]: https://github.com/microsoft/WSL/issues/9059
[2]: https://devblogs.microsoft.com/commandline/a-preview-of-wsl-...
They tend to be issues that 'seem' advanced, but the missing functionality is usually something that the vast majorities of developers who have run a Linux desktop for development would take for granted as a possibility.
Docker in WSL2? Yeah sure, but I'd rather install a VM or connect to a remote Docker host.
MinGW/MSYS2 have been around far longer and have none of those issues... Then again, MSYS2 does not have a Linux kernel running under it but that shouldn't be a problem unless you want to run containers.
Cross OS filesystem performance is poor. The solution is to keep everything within WSL. Code stored, built & edited in WSL.
VSCode + WSL extension makes it possible to "edit" from host without loosing performance.
No you didn't, you just let Windows hide them from you. WSL2 is essentially a Hyper-V VM running Linux with some programs bridging between it and the Windows host -- or two such VMs with some additional bridging (for Wayland and audio) if WSLg is enabled.
PS C:\Users\coolcold> netsh wlan show interfaces|wsl -- fgrep Mbps
Receive rate (Mbps) : 121.5
Transmit rate (Mbps) : 121.5
or, from WSL side, you can invoke Explorer for current folder via simple explorer.exe .
or notepad ..or..In all seriousness though, is there a reason ripgrep doesn’t suffice?
>Something something vim/emacs.
There's value in having a compatibility layer for a universal command line. Besides, even WSL2 is barely a VM
On serious side, even `findstr` is enough, but goal was to show interop in action, not to choose best grep alike solution.
On other serious side, I can ensure and enforce standardization on having WSL across the teams and departments and be sure such snippets work. Standardizing on ripgrep probably doesn't worth it.
For lonely/solo/indi technician that makes no sense and ripgrep can be better of course.
WSL is a proper VM, just managed very efficiently by Hyper-V.
> the filesystem has its (performance) limitations
It's a normal Linux filesystem, there's no difference in performance vs. a full-fledged Linux VM. (which it is anyway)
Are you referring to WSL1?
> It's a normal Linux filesystem, there's no difference in performance vs. a full-fledged Linux VM. (which it is anyway)
> Are you referring to WSL1?
WSL2 just exchanged the performance problems with the Linux guest environment's native filesystem for performance problems when the Linux guest accesses Windows' filesystem. Those are still there and they're still atrocious.
So I kinda disagree, for all things you mention I prefer WSL.
Wait, is it? I thought that Docker on Windows has always run in a VM. Used to be Hyper-V directly and now they're moving towards WSL2[0].
I don't EVER find that I need some kind of *nix command on my local machine when developing, but that's also because I'm not afraid of PowerShell / stuck on bash.
Have you sorted out how to get fuzzy tab completion in PowerShell, short of the buggy, menu-y integration available with fzf?
Do you find the everything you need is just already in PowerShell or so you sometimes run third party command line executables? If the latter, how do you deal with lack of man pages?
PS C:\Users\coolcold> netsh wlan show interfaces|wsl -- fgrep Mbps
Receive rate (Mbps) : 121.5
Transmit rate (Mbps) : 121.5Latest issue I encountered was that GNU parallel simple does not work. [1]
https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-dis...
Get-Content -Path Filepath -Tail <int>
You just did.
Microsoft is the worst company on the planet when it comes to version numbers. Don't even get me started about "Xbox One".
https://arstechnica.com/gadgets/2022/09/usb-if-says-goodbye-...
> Microsoft is the worst company on the planet when it comes to version numbers.
I take some bleak comfort in the fact that this subsystem appears to be built on New Technology Subsystem Technology...
Anyway nobody is really worse than USB-IF who recently released USB4 2.0 specification.
So you had:
- iPad ("iPad")
- iPad 2 ("iPad 2" or "iPad 2nd generation")
- iPad 3 ("The new iPad")
- iPad 4 ("iPad with Retina display")
So in late 2012 you had people shopping, and having to pick between "The New iPad" (last year's model), "iPad with Retina display" (this year's model), and the iPad Air.
Apple stopped after that, going with iPad [type] [number] naming.
[1] https://en.cdprojektred.com/download/patch-3-3/ [2] https://www.dota2.com/patches/7.32c [3] https://cwiki.apache.org/confluence/display/WW/Version+Notes...
Will there also be WSL 1 2.0 then? But WSL 1 was never called 1, it was just WSL in contrast to WSL 2.
As an aside, I love WSL. Some of my favorite software out of Microsoft in years.
Especially since there is some feature discrepancy between WSL1 and WSL2, sometimes there is a need to use the former.
Mostly because the newer version forces you into Hyper-V, and I'd rather not be committed to that hypervisor
If I'm on Windows I'm much more likely to want good old VMWare Workstation. Enabling WSL2/Hyper-V precludes this
I haven't had nearly as good of an interactive (UI capable) guest experience with anything else (beyond KVM with QXL/Spice)
Edit: At risk of arguing their merits, video game anti-cheat clients will often categorically refuse to run if Hyper-V is enabled, too.
WSL2 is like a car that's great in most ways but for some reason just cannot make right turns from one-way streets. You might not encounter that particular situation very often but your car still needs to be able to do it or else it's just an annoying 3/4-baked thing that is better just skipped until it's actually fully functional.
This seems like a case where they should have picked a different naming scheme rather than numbers like WSL-A and WSL-B or something.
Until then, I was trapped in Windows land as both a dev and a user.
If you look at the graphic at the top of https://en.wikipedia.org/wiki/Architecture_of_Windows_NT it makes sense. But the fact that it needs this in order to make sense, is why it shouldn't have survived as a product name.
WSL uses pico processes:
https://learn.microsoft.com/en-us/archive/blogs/wsl/windows-...
https://learn.microsoft.com/en-us/archive/blogs/wsl/pico-pro...
Someone high up at the FSF called the first WSL "GNU/kWindows". Probably the best name of all.
Removed the "Preview" label - WSL in the Store is now generally available!
Use an override in generator.early to prevent the /tmp/.X11-unix socket from being removed during boot
Don't create a pty for systemd to fix issue where systemd would time out during boothttps://devblogs.microsoft.com/commandline/systemd-support-i...
I only use Windows for games nowadays
And yes, I think it's a bit silly. But WSL has helped us comply with the business/security requirements while still using (IMO) better dev tools and workflows that Linux provides.
In the past, when I worked at companies like that, you could still stick the IT garbage laptop in a drawer, and then BYOD for development work (which is what I did...)
That way, the board gets the conflict-of-interest software license slush money, and the developers can do their jobs. Win-win.
Brilliant. Its like something straight out of The Hitchhikers Guide.
I think it still has a few rough edges,but fortunately I haven't had to deal with those. Also recently they added support for systemd which is awesome. Most packages "just work".
Strange naming sequence. I thought it was a commemorative post about the anniversary of the first WSL, or something like that.
This is "WSL 2, 1.0".
The software that was released as WSL2 some years ago, is some other version apparently.
To get the same environment that is WSL (namely a virtual machine with tight integration and low overhead), Apple provides Hypervisor.framework: https://developer.apple.com/documentation/hypervisor
Honestly, i just want a replacement for vmware that uses less resources. So i can run a completely isolated desktop for each project i'm working on. Suspend it, reboot my machine, and then load it up and continue where i left off, all windows and terminal sessions intact. The last bit assumes one can run a (non ephermal) graphical desktop of course, which rules out docker pretty much.
netsh interface portproxy add v4tov4 listenport=8001 listenaddress=0.0.0.0 connectport=8001 connectaddress=172.24.75.111
where connectaddress is whatever you get from running ifconfig on wsl side. Edit: Might also use localhost instead of IP as the connectaddress, as the IP might change. Depends on what your server software handles of bindings.Depending on your machine configuration, you might need to open the port in your firewall as well, ala
netsh advfirewall firewall add rule name="Allowing connections on 8001" dir=in action=allow protocol=TCP localport=8001The only missing piece for me was a tiling window manager, so I developed my own for Windows based on a mixture of bspwm, yabai and leftwm.
Being able to do gpu stuff is also pretty awesome too.
I can finally use makefiles in a sane way again.
I also have an issue with flask having a buggy http server by default (sending files seems to stall with http 206), I still have to try if it works better on WSL.
> The most recent version of Windows Subsystem for Linux is already installed.
I'm stuck on 0.70.4.0
I have to admit WSL is hands down the single most amazing addtion that Microsoft has implemented into Windows since giving us 64 bit.
I could totally still use Windows XP, but not without WSL
edit: I can also confirm, that they ported WSLg back to Windows 10. \o/
It's purely a repo for reporting issues.