News for hackers. Stuff that matters.
Re:WSL2 can now mount Linux ext4 disks directly by simonh on Tuesday November 09, 2021 @07:30AM (#29160822)
You can launch into a WSL shell in seconds without having to wait for a VM to spin up. WSL doesn't run the full slew of linux processes and uses the same memory space, so both CPU and memory utilisation is much lower than a VM. You don't need to contend with all the fiddly configuration parameters and config of VM software, and it integrates into the Windows environment by default, again without fiddly configuration.

If you're doing sysadmin work or web development, and need to run Windows software as well or are on hardware with better Windows support, it's hard to see why you wouldn't use WSL.

To your point on total control of the emulation, not everybody needs that. If your use case means you need a real Linux OS environment, then sure, WSL isn't for you.

Re:WSL2 can now mount Linux ext4 disks directly by TheRealDunkirk on Tuesday November 09, 2021 @07:34AM (#29160876)
> WSL doesn't run the full slew of linux processes and uses the same memory space, so both CPU and memory utilisation is much lower than a VM.

Well, I thought this was the case with WSL, but that WSL2 changed this, such that it's really just a full-blown VM now. Are you saying that you're still using WSL 1, or have I misunderstood the nature of WSL2?

Re:WSL2 can now mount Linux ext4 disks directly by jve on Tuesday November 09, 2021 @07:39AM (#29160924)
WSL2 still runs instantly. I haven't been bothered with waiting. I tried wsl --shutdown and then opening wsl - didn't take a second. Cold boot may have been longer, but I don't remember being bothered with startup times. However older powershell console startup time did bother me for sure.
Re:WSL2 can now mount Linux ext4 disks directly by alxlaz on Tuesday November 09, 2021 @07:38AM (#29160912)
Neither :-). WSL2 runs a full-blown machine but the startup process is considerably different from that of a real machine with a real Linux installation, so when you "start up" a WSL2 shell, it's spawned in seconds, you're already logged in and so on. It's essentially the WSL1 presentation format but with a different back-end.
Re:WSL2 can now mount Linux ext4 disks directly by girvo on Tuesday November 09, 2021 @08:35AM (#29161504)
Though my Ubuntu VM on Hyper-V with multipass giving the Microsoft Terminal integration started up basically just as fast, to be honest.

But the deeper integration and lighter underlying OS for WSL2 is better, especially for Docker dev container usage with VSCode.

Re:WSL2 can now mount Linux ext4 disks directly by vbezhenar on Tuesday November 09, 2021 @07:52AM (#29161068)
> You can launch into a WSL shell in seconds without having to wait for a VM to spin up.

Start VM in background at boot time and ssh in milliseconds when necessary.

> WSL doesn't run the full slew of linux processes

I don't know what linux processes are you talking about, but minimal Linux ram consumption is something like 50 MB, that's hardly noticeable.

> uses the same memory space

RAM ballooning is available in VirtualBox or Vmware for years.

> CPU utilisation is much lower than a VM

I don't think that's true. There's no inherent CPU utilization in Linux (and WSL2 is VM).

> You don't need to contend with all the fiddly configuration parameters and config of VM software, and it integrates into the Windows environment by default, again without fiddly configuration.

And that's probably the main reason why WSL is so popular. Installing VM software, creating virtual machine with proper configuration, installing guest tools, configuring it to start/stop at host OS boot/shutdown, configuring shortcuts for ssh is out of reach for most developers and power users. WSL just simplified that process. Probably could be implemented with some wrappers around VBoxManage years ago, but nobody understood the problem.

Re:WSL2 can now mount Linux ext4 disks directly by NikolaNovak on Tuesday November 09, 2021 @08:02AM (#29161159)
Interesting; different perspectives I suppose; not the OP, but for myself too VM always seemed an easier and cleaner solution:

1. Isn't WSL2 now actually a VM too? My biggest deal breaker with WSL2 is that it moves my main Windows into now a parent VM over the Type 1 hypervisor; making everything else in my main Windows just that little bit wonkier. Worse, this information isn't as readily easily grokkable as I feel it should be. I.e. if somebody isn't comfortable installing a clean, separate VM in Virtualbox, they may be even less aware of consequences of moving their main Windows installation into a VM now.

2.Re fiddliness: Installing Ubuntu into VIrtualbox has always seemed trivially easy; and there's any number of downloadable pre-built images from safe sources. Whereas figuring out how to access Windows filesystem from WSL2 and vice versa; let alone installing GUI tools - always seemed completely opaque to me with any number of half-built, quarter-supported guides and solutions out there. And I never seem to know or guess correctly what subset of Linux functionality will or will not work, normally or differently.

Re:WSL2 can now mount Linux ext4 disks directly by sixbrx on Tuesday November 09, 2021 @09:08AM (#29161899)
I think #1 (running Windows itself via HyperV) is just the direction Windows is going anyway, and WSL2 is just one of the features that require it. Another one that requires it is the "Windows Defender Application Guard" which can isolate browser instances and other stuff.

https://techcommunity.microsoft.com/t5/virtualization/hyper-...

Re:WSL2 can now mount Linux ext4 disks directly by dboreham on Tuesday November 09, 2021 @08:24AM (#29161386)
> moves my main Windows into now a parent VM over the Type 1 hypervisor

Are you sure about this? It seems unlikely that NT would change significantly depending on whether or not it is hosting a WSL2 guest. I've never noticed anything different about my Windows since using WSL2.

> Windows filesystem from WSL2 and vice versa

/mnt/C/

\\wsl.localhost\Ubuntu

Re:WSL2 can now mount Linux ext4 disks directly by hadik on Tuesday November 09, 2021 @08:36AM (#29161513)
WSL2 is architecturally designed to run under Hyper-V, so when you activate WSL2 on your machine, Hyper-V runs on bare metal and your Windows installation just becomes another VM running inside it next to the WSL2 Linux environment. Unfortunately this is imho not explained as well as it should be, because, while most of the time most people won't notice any difference, there is a measurable impact with regards to performance (in games, for example). It depends on your specific setup how bad it gets, and in most cases it's more of a theoretical performance hit than a noticeable one, but it is still there.
Re:WSL2 can now mount Linux ext4 disks directly by freefolks on Tuesday November 09, 2021 @09:49AM (#29162444)
It downclocks my ram to 800mhz if I enable vt in bios. My new cutting edge system turns into a pentium 4. Apparently this is a bug with windows 11. Hope it gets fixed
Re:WSL2 can now mount Linux ext4 disks directly by NikolaNovak on Tuesday November 09, 2021 @10:17AM (#29162815)
As I said, it is NOT documented well; and even when you do confirm that WSL2 engaged Hyper-V, the ramifications are even more poorly explained.

But yes, everything I've read and experienced indicates that:

1. WSL2 IS a VM and it necessitates installation of certain portions of Hyper-V, which as Type-1 hypervisor, means your primary windows partition is no longer bare-metal but rather now a parent virtual machine.

2. This has impact on running other Type 2 hypervisors such as VirtualBox or VMWare etc; as well as some types of performance-intensive applications and games.

https://docs.microsoft.com/en-us/windows/wsl/faq

Re:WSL2 can now mount Linux ext4 disks directly by morpheuskafka on Tuesday November 09, 2021 @08:36AM (#29161510)
It is true for any system that has Hyper-V enabled and should work perfectly fine. Same as if you have a Windows VM guest or a traditional Linux VM. WSL2 uses and manages a small VM under the hood so enabling it will cause this change to the windows boot process if it was not already so.
Re:WSL2 can now mount Linux ext4 disks directly by girvo on Tuesday November 09, 2021 @08:40AM (#29161565)
Yeah it actually does. Crazy, I know.

They’re also doing the same for Windows 11 by default now too I believe.

> In addition, if you have Hyper-V enabled, those latency-sensitive, high-precision applications may also have issues running in the host. This is because with virtualization enabled, the host OS also runs on top of the Hyper-V virtualization layer, just as guest operating systems do.

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-w...

Re:WSL2 can now mount Linux ext4 disks directly by fretn on Tuesday November 09, 2021 @08:23AM (#29161375)
Can you give some more info about your first point, where your main Windows is moved into a parent VM ?
Re:WSL2 can now mount Linux ext4 disks directly by NikolaNovak on Tuesday November 09, 2021 @10:30AM (#29163000)
Sure:

1. https://docs.microsoft.com/en-us/windows/wsl/faq

"The newest version of WSL uses Hyper-V architecture to enable its virtualization"

A little bit of detail on impact, but incomplete/generic.

2. https://docs.microsoft.com/en-us/windows-server/administrati...

"Hyper-V features a Type 1 hypervisor-based architecture. "

Re:WSL2 can now mount Linux ext4 disks directly by girvo on Tuesday November 09, 2021 @08:41AM (#29161577)
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-w...

Has some basic info, worth a read.

> In addition, if you have Hyper-V enabled, those latency-sensitive, high-precision applications may also have issues running in the host. This is because with virtualization enabled, the host OS also runs on top of the Hyper-V virtualization layer, just as guest operating systems do.

Re:WSL2 can now mount Linux ext4 disks directly by formerly_proven on Tuesday November 09, 2021 @08:27AM (#29161409)
That's just how Hyper-V (Microsofts VM hypervisor) works, it's a type 1 (bare metal) hypervisor, where everything else runs in a VM.
Re:WSL2 can now mount Linux ext4 disks directly by allendoerfer on Tuesday November 09, 2021 @08:04AM (#29161177)
> Probably could be implemented with some wrappers around VBoxManage years ago, but nobody understood the problem.

I'd say vagrant did something in that area.

Re:WSL2 can now mount Linux ext4 disks directly by nikau on Tuesday November 09, 2021 @07:20PM (#29169446)
I think the biggest advantage of WSL2 is being off the radar - corporate IT support will just be "oh its a Microsoft product, install approved, add to whitelist in all security monitoring products".

Rolling your own implementation with vmware poses the exact same security and compliance risks, but its way more likely to put a spotlight on you.

Re:WSL2 can now mount Linux ext4 disks directly by cle on Tuesday November 09, 2021 @08:01AM (#29161144)
From a legal perspective it’s probably best to avoid any Oracle IP.

(I still agree with your overall point though.)

Re:WSL2 can now mount Linux ext4 disks directly by simonh on Tuesday November 09, 2021 @08:57AM (#29161763)
Processes like systemd. Does the average developer or sysadmin really pare their Linux down to 50mb?

Look, if you want to tune your VM exactly to your liking then use a VM. It will give you a lot more control.

Re:WSL2 can now mount Linux ext4 disks directly by yakubin on Tuesday November 09, 2021 @07:45AM (#29160992)
> You can launch into a WSL shell in seconds without having to wait for a VM to spin up.

Serious question: how long does it take to spin up a VM on Windows then? Does it take seconds?

(Not disputing your other points.)

Re:WSL2 can now mount Linux ext4 disks directly by tehbeard on Tuesday November 09, 2021 @08:09AM (#29161229)
For a "cloud image" I have in virtualbox (so no gui) for testing cloud-init/ansible, about 15-20 seconds.

WSL1 takes about a second, and I'm pretty sure most of that is the init script that spits out network/update info.