What does HackerNews think of WSL2-Linux-Kernel?

The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)

Language: C

This was true for WSL1, but WSL2 does contain a Linux kernel. The source code for it is available at:

https://github.com/microsoft/WSL2-Linux-Kernel

We're at the embrace stage right now, that's why you see it getting integrated.

And if you run WSL, you usually end up with a special kernel, it's not just the upstream one without changes.

Both my Arch and Ubuntu WSL is on kernel `Linux desktop 5.15.90.1-microsoft-standard-WSL2` rather the ones the distributions ship with by default if installed normally. This is the one they ship via Windows Update which you end up using on WSL: https://github.com/microsoft/WSL2-Linux-Kernel

Watch them slowly make it different than the upstream one, without contributing patches upstream.

WSL2 is for the most part totally usable for everyday development, but it does have a handful of issues that either need workarounds or are just infeasible.

USB passthrough isn't yet supported, so it's necessary to make use of something like VirtualHere[1] or some another TCPIP tunneling daemon running on the windows depending on what you're trying to do.

There seems to sometimes be issues with resuming from S0ix sleep where the VM process is still "running" but it gets stuck in a state where new processes just will not spawn. It's been a while since I messed with it, but my "solution" was disabling a VM security measure, launching Process Hacker 2 as admin, searching for "lxss" in the process list and terminating the corresponding svchost.

The actual linux kernel running inside WSL2 is interesting, it's microsofts own custom kernel[2] with some magic sauce for making everything play nice. Unfortunately, it (still?) lacks a fully-functional SystemD so making some programs work can be a chore. Also all the kernel modules compiled in, and it doesn't allow loading them dynamically with modprobe. There are some alternative kernels out there that solve some of these issues, though I haven't bothered to try any since whenever I run into these sorts of issues it's less of a hassle to just switch to a dedicated linux box.

For all of the issues that come with Windows 11, having WSLg make running graphical programs "just work" out of the box with rock-solid copy/paste, alt+tab, etc., really makes it a joy to work with.

[1] - https://www.virtualhere.com/

[2] - https://github.com/microsoft/WSL2-Linux-Kernel

That's exactly what I mean by misinformed. WSL 2 isn't using a simple virtual machine the way it is generally understood. It is instead using a lightweight VM using Hyper-V, there is no booting time. IO in itself isn't slow if you move files to the Linux FS. What is slow is the communication between Windows <—> Linux filesystems.

Edit: regarding the custom kernel, you can create your own if you want, nothing is blocking you from doing so https://kumekay.com/compiling-custom-kernel-for-wsl2/.

Microsoft's kernel is also available on github: https://github.com/microsoft/WSL2-Linux-Kernel.

Don’t try to rephrase what I said to put words in my mouth. I stated a fact, which you can verify here if you please. https://github.com/microsoft/WSL2-Linux-Kernel Please let us know what you find.
Microsoft already has a Linux kernel. https://github.com/microsoft/WSL2-Linux-Kernel

If it were superior for containers, Windows containers wouldn't have withered on the vine.

.NET Core being truly cross-platform is pretty much an official acknowledgement by Microsoft that Windows is not the be-all and end-all. To use their words, they're "meeting developers where they live" instead of insisting that one size fits all, if that size is Windows.

WSL2 actually uses a virtualized Linux kernel, as opposed to WSL1, which implemented Linux APIs on top of Windows, a la Wine.

Here's the source (literally). https://github.com/microsoft/WSL2-Linux-Kernel

The Microsoft Linux Kernel that ships with WSL2[1] was by far the biggest "wow" moment for me. I honestly never thought I'd see those 3 words together in my lifetime.

[1]https://github.com/microsoft/WSL2-Linux-Kernel

Is this the wrong repository for what you are referring to, as this appear open source?

https://github.com/microsoft/WSL2-Linux-Kernel

Hi. Microsoft PM working on WSL, Terminal and Windows.

WSL2 literally runs user-mode distros (and their binaries) in containers atop a shared Linux kernel image (https://github.com/microsoft/WSL2-Linux-Kernel) inside a lightweight VM that can boot an image from cold in < 2s and which aggressively releases resources back to the host when freed.

So when you run a binary/distro on WSL2, you are LITERALLY running on Linux in a VM alongside all your favorite Windows apps and tools.

If some of the tools you run within WSL can take advantage of the machine's available GPUs etc. and integrate well with the Windows desktop & tools, then you benefit. As do the many Windows users who want/need to run Linux apps & tools but cannot dual-boot and/or who can't switch to Linux full-time.

This will (and already has) resulted in MANY Windows users getting access to Linux for the first time, or first time in a while, and are now enjoying the best of both worlds.

The point is in WSL2 rather than emulating the Linux kernel, they just run it:

https://en.m.wikipedia.org/wiki/Windows_Subsystem_for_Linux

https://github.com/microsoft/WSL2-Linux-Kernel

The Xbox One also uses a hypervisor to run multiple OSes, one of which was Windows 8:

https://en.m.wikipedia.org/wiki/Xbox_One_system_software

https://wccftech.com/xbox-one-architecture-explained-runs-wi...

They started doing that with the Xbox 360.

They have released the source for their fork: https://github.com/microsoft/WSL2-Linux-Kernel.

Linux specifically does not use the GPLv3 for exactly this reason. rms et al. complained about "tivoization", which came from tivo shipping boxes that contained the code but were locked down. Linus didn't really care as much, or at least not enough to re-license. He didn't like the restriction, and new that such a provision would prevent exactly what MS is now doing: allowing more freedom for the users.