Live data from Hacker News

WSL Manager

github.com

41–50 of 65 posts

Re: WSL Manager

#41
post #39

Earlier quoted context omitted.

Is there a way to visualize this on a running system or some documentation that describes it? I'm not familiar with the plumbing here but did try to find some documentation.

I've done a lot of in-depth WSL2 work, so I'm just aware of its particulars, but to cite some documentation- https://learn.microsoft.com/en-us/windows/wsl/about "WSL 2 uses virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). Linux distributions run as isolated containers inside of the WSL 2 managed VM. Linux distributions running via WSL 2 will share the same network…

Thanks, it wasn't out of doubt that I asked, but it seemed having a reference to point at would help resolve the contention. The Docker blog post covered a lot more detail, even about WSL2, which was really informative and I hadn't seen.

I wonder exactly how much work "container" is doing in that Microsoft blog post's description, because it doesn't seem like it's the same kind of environment as a runc or containerd container?

I also wasn't quite sure how much detail to infer from the behavior of vmmemWSL or vmcompute.exe, because my casual understanding is that there's some adaptation layer that handles mapping Linux calls to Windows calls. It seems reasonable to allow for process mapping or accounting shenanigans for any number of good reasons.

Re: WSL Manager

#42
post #41

Earlier quoted context omitted.

I've done a lot of in-depth WSL2 work, so I'm just aware of its particulars, but to cite some documentation- https://learn.microsoft.com/en-us/windows/wsl/about "WSL 2 uses virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). Linux distributions run as isolated containers inside of the WSL 2 managed VM. Linux distributions running via WSL 2 will share the same network…

Thanks, it wasn't out of doubt that I asked, but it seemed having a reference to point at would help resolve the contention. The Docker blog post covered a lot more detail, even about WSL2, which was really informative and I hadn't seen. I wonder exactly how much work "container" is doing in that Microsoft blog post's description, because it doesn't seem like it's the same kind of environment as a runc or containerd…

>there's some adaptation layer that handles mapping Linux calls to Windows calls

This was how WSL1 functioned. It used a shim layer, and honestly it was pretty neat for a lot of the basic stuff. It fell apart if you were doing more complex/advanced stuff, however, as there were many missing cases and exceptions.

WSL2 instead uses that utility VM, with a couple of special Microsoft kernel drivers to interact with the host system.

Re: WSL Manager

#43
I wish there were more ways to specify whether the Windows filesystem /mnt/c should be mounted in a WSL2 instance - it is kind of generally on or off. In cases where I want WSL2 to function as a "container" isolated from my desktop, I use a different Windows user just in case.

Re: WSL Manager

#44

Neat project. Merging the layers of a docker image and setting that as a WSL filesystem is a nice convenience. I recently realized that 100% of what I use Windows for was as a WSL2 foundation: It had been reduced to being an extremely overbearing and heavyweight host machine for a Linux VM. Nothing in my life was Windows-only anymore, and it was basically just inertia that I even still had it installed. I'd been a "W…

Right there with you. When Microsoft started pushing Windows 11 over Windows 10, that's when I decided I had enough of my experience being dumbed down. I switched over to Linux, haven't looked back, and couldn't be happier. I still run a Windows virtual machine for those times that I need something native to that operating system, but I should have made the move years ago; Microsoft doesn't care about Windows anymore.

Re: WSL Manager

#45

Earlier quoted context omitted.

I'm glad I'm not alone in missing native apps. I get that it's easier to code a note-taking Electron app, but every time I look at a Linux terminal app written in JavaScript it makes me want to cry. I know I'm beating a dead HN horse here, but how the hell is it possible that megabytes of embedded JavaScript in websites, to the point that LinkedIn uses about half the RAM I had for my first computer loading 32 MB of J…

> The customers clearly don't want this bloat, citation needed. the customers clearly want it, for example most programmers chose VS Code over a native app

If there was a vs code native alternative that was parity, that might not be a case. That's apples and oranges

Re: WSL Manager

#46

Neat project. Merging the layers of a docker image and setting that as a WSL filesystem is a nice convenience. I recently realized that 100% of what I use Windows for was as a WSL2 foundation: It had been reduced to being an extremely overbearing and heavyweight host machine for a Linux VM. Nothing in my life was Windows-only anymore, and it was basically just inertia that I even still had it installed. I'd been a "W…

It's interesting because I'm the same in so much that I use windows basically as a WSL2 host and not much else. I use a MacOS a lot.

_However_, still find the Linux desktops that I've tried are too buggy. While the hardware support is incredible (compared to Windows out of the box), I constantly hit bugs with fractional scaling on multiple monitors. I'm hopeful that Ubuntu 26.04 may finally iron out the last problems with this. The latest version of Fedora I installed did fix all this but I'm far too used to Debian based OSes.

Re: WSL Manager

#47

Earlier quoted context omitted.

> The customers clearly don't want this bloat, citation needed. the customers clearly want it, for example most programmers chose VS Code over a native app

If there was a vs code native alternative that was parity, that might not be a case. That's apples and oranges

Sublime Text? Sure, doesn't have the long tail of extensions, but surely most people don't need those. The biggest issue with ST being the fact that it costs money...

Re: WSL Manager

#48
post #37

Earlier quoted context omitted.

"Running $N containers as separate WSL instances runs $N VMs and $N linux kernels." But it doesn't, and this is what I'm disagreeing with. If you instantiate WSL2, it launches a Linux VM. A single Linux VM. If you then run Docker with WSL2 integration (the default and hugely recommended), it uses that Linux VM as its VM as well, so you're still at 1 VM. If you run 100 WSL2 instances, they will all use that single Lin…

Every time you run `wsl --install ` you are creating a new VM. Every time you run `wsl --unregister ` your are removing a VM. It is these two operations at the heart of OP's app.

No, this is wrong.

WSL2 distributions share the same Linux kernel. They only get their own root filesystem with a Linux userland (/bin, /usr, /lib etc), and some WSL config meta data. This is then stored as a virtual disk image (which is probably where your belief comes from). But the kernel runs in a single utility VM. The distros share that kernel instance and they are separated via namespaces only.

This makes running multiple WSL2 distributions in parallel very performant btw, as there is no world switch.

Re: WSL Manager

#49
post #37

Earlier quoted context omitted.

"Running $N containers as separate WSL instances runs $N VMs and $N linux kernels." But it doesn't, and this is what I'm disagreeing with. If you instantiate WSL2, it launches a Linux VM. A single Linux VM. If you then run Docker with WSL2 integration (the default and hugely recommended), it uses that Linux VM as its VM as well, so you're still at 1 VM. If you run 100 WSL2 instances, they will all use that single Lin…

Every time you run `wsl --install ` you are creating a new VM. Every time you run `wsl --unregister ` your are removing a VM. It is these two operations at the heart of OP's app.

This is not true - it's actually all the same VM if you check hcsdiag.

WSL2 distros only use Linux namespaces, same as docker, and the WSL2 --system distro can see PIDs from all running WSL2 distros.

Re: WSL Manager

#50
My WSL Ubuntu instance always gets disconnected after I come out of sleep or hibernation mode. Anyone else faced this issue and any solutions? I have tried everything found online.
Post reply on HN