WSL1 became unusable - I finally switched to WSL2
When WSL1 first appeared I was pretty excited, a lot of people claim today that because WSL, Windows is the best platform for developers, personally these days I think any OS from the big three can act as a perfect developing platform since many of us use docker anyway.
But back to WSL1, what I really liked was the WSL1 was Cygwin on steroids a kind of "Linux Wine", and that meant a lot from the perspective of OS development, because it really was a step in the direction of merging OSes rather than have yet another virtual machine.
I mostly switched to WSL2 because I grew tired of my applications crashing because WSL1 was missing some implementations, and I thought I wasted enough time on workarounds like setting Nginx buffering to off, replacing libc libraries, replace system binaries with custom scripts, replacing apt repos with custom ones, adding custom apt repos, changing network IP version preference, avoid using Unix sockets and so on and on(but even TCP wasn't fully implemented, constantly you could bumble into TCP_INFO error), so basically WSL1 is not extremely stable.
And let's be honest WSL1 is an incredible piece of software, but in the last year, it received so little attention from the core devs that many of us including me are starting to think it will likely be abandoned. Is hard not to get this feeling when you see issues on GitHub marked as fixed-in-WSL2. And it likely appears that 90% of the developing effort goes towards WSL2, which helped WSL2 a lot, considering that WSL2 from that start was plagued with poor performance, slow startup, inability to access windows files, and without a network bridge between the localhost of the host and VM, but all these today are gone and the and WSL2 has improved significantly, moreover devs are promising that in the future the speeds which WSL2 will be able to access Windows files will increase, which is actually the main problem that WSL2 has now.
If WSL2 will clear this last hurdle then the argument can be made that WSL1 is no longer needed, but I really hope that will not happen, first of all, because, in my opinion no matter how thin is a VM, a VM is not a subsystem layer it as the name implies another machine, so it's hard to argue that resolving Linux system calls with Window natively is not a better definition of what a subsystem layer should be.
Another thing many WSL2 users want is a static IP for their VM, which not very easy to do now, I guess static IP would be good for a lot of things, including setting a Port Forward from the host machine to the VM since now that we are talking about a VM that can't be accessed remote without a port forward, and you may want to access it remotely if you want to set up your web environment with SSL.
Luckily you can do that with some scripts, there are many on GitHub, normal I run only "start linux httpd - mysql.cmd" which runs other two scripts, one to start the services, and one to port forward 8443(SSL which is proxied trough ClouldFlare) so that I expose the VM to remote access.
File: "start linux httpd - mysql.cmd"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\Users\andrei0x309\Desktop\service scripts\Port Forward 8443 WSL2.ps1""' -Verb RunAs}"
bash "/mnt/c/Users/andrei0x309/Desktop/service scripts/linux start httpd - mysql.sh"
pause
File: "linux start httpd - mysql.sh"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\Users\andrei0x309\Desktop\service scripts\Port Forward 8443 WSL2.ps1""' -Verb RunAs}"
bash "/mnt/c/Users/andrei0x309/Desktop/service scripts/linux start httpd - mysql.sh"
pause
File: "Port Forward 8443 WSL2.ps1"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\Users\andrei0x309\Desktop\service scripts\Port Forward 8443 WSL2.ps1""' -Verb RunAs}"
bash "/mnt/c/Users/andrei0x309/Desktop/service scripts/linux start httpd - mysql.sh"
pause
Depending on your WSL2 distro you might have to change how the IP from the VM is extracted, since ifconfig
is not available on all distros.