GeekNights Monday - Windows Subsystem for Linux

Not technically WSL, but kinda tangential, winget install steam, for example, is now a valid command in Windows (if you install Winget from Microsoft, which will soon be pushed out)

image

/sadtrombone

At least I got it on my work laptop, where I use WSL the most.

Setup WSL2 on my work laptop today with Ubuntu 20.04.

Performance is vastly improved. Everything pretty much ā€œjust workedā€.

One really good thing is that they managed to find a way to make the networking easier. By default they have enabled some localhost trickery. I can run a server on WSL2 on a port, and then my app running on actual windows, outside the VM, can connect to that port on localhost. Iā€™m not sure how this works, automatically generated tunnels? Iā€™ll have to look into it.

Bad news, this only works in one direction. A client inside the WSL2 VM can not contact a service running on Windows on localhost. How often do you want to do that? Not often except for the X server! The solution is to take advantage of some other trickery. export DISPLAY=WINDOWS.WSL.IP:0.0 How do you get this internal WSL IP address? Thanks to some other trickery! To make networking easier they are doing some sort of DNS proxy and automatically writing the resolv.conf when the VM starts. Now you can parse the IP from the resolv.conf and export it in the DISPLAY variable.

Final problem. There is a very easy command to convert a WSL1 to WSL2 and back. You can have distributions co-existing simultaneously. I even went so far as to have one x server with one window manager, but terminals from a WSL2 VM and a WSL1 both connecting. The power of X! However, when you convert, at least from 1 to 2, it takes forever. Why? Windows built in real-time anti-virus. Disable it before you attempt conversion, and re-enable it afterwards.

2 Likes

Why do you need X?

Why wouldnā€™t you need X?

Emacs.

I mean, I could use vim in the terminal, but I use gvim.

Also, even if I were to only use terminals, Linux terminal emulators running in X are still way better than the new and vastly improved Windows Terminal.

And even if I used the new improved Windows Terminal, it would be in a Windows window. I would still want to run X full screen and use i3wm to manage the terminals.

At this rate Iā€™m going to get the July 2020 update.

1 Like

Now hoping to avoid August 2020 update!

Why? My work PC got the July update, but my personal desktop still doesnā€™t have it without forcing the issue. Iā€™m reluctant to do that because I suspect I will have ā€œdifficulty connecting to more than one Bluetooth device.ā€

Avoiding a Windows update is never a good idea in the year 2020.

I meant Iā€™m hoping to get it before August. Iā€™m in the same boat - not going to force it. But it would be nice to get the MAY update with that WSL2 hotness.

Just making sure :wink:

Today Iā€™m letting Adobe, GeForce, and a bunch of other stuff update all at once.

Finally got it! Letā€™s see how fast this subsystem is now.

Iā€™m very interested to know. Iā€™ve only got WSL2 on my work laptop. There are definitely some speed ups in the file system department, but overall itā€™s not that fast because the machine itself is the bottleneck.

My desktop still wonā€™t let me upgraded to 2004. What the hell is taking them so long? I donā€™t really get the sense that this is urgent for Microsoft, and thatā€™s kind of strange and embarrassing. You could only get your latest Windows update out to a small percentage of PCs and have bugs that have just been sitting on it for over two months now? Feel like that should be an all hands on deck situation.

One thing I have noticed is that while WSL2 may be faster while itā€™s running, it has some serious startup lag. I think it might be related to the networking. Whenever I enable my VPN on the work laptop, even if WSL2 is running it will completely lock up and then eventually come back to life.

One other thing. If I have my X server running and then the laptop goes to sleep, itā€™s completely shot when the laptop wakes up. I canā€™t interact with it at all. Have to close the whole thing and start again. So make sure if you have a gvim window or something, to save and quit before going to sleep.

2021: the year of the Linux desktop. Incredible.