How to install & upgrade Windows Subsystem for Linux 2.0
Yesterday I made a post talking about Windows Subsystem for Linux 2.0 and the improvements over 1.0.
This post will go over how to install Windows Subsystem for Linux 2.0 if you don't have it installed already and how to upgrade if you have WSL 1.0 already installed.
Installing WSL 2.0
Update to Windows version 2004
You first need to make sure you have Windows 10 build version 2004 or greater. You can check your build by going to system.
If you do not already have 2004 and you do not see any updates under Windows Update, you can force the install by using Microsoft Windows Update Assistance. The upgrade will take around an hour.
Install Subsystem for Linux
In the start menu launch the program and features settings by typing in features
You want to select both Windows Subsystem for Linux & Virtual Machine Platform
Once these finish installing, you will be asked to reboot.
Install the kernel update
Seeing as Microsoft now uses a real Linux kernel with WSL 2.0, you need to install the kernel update patch.
Microsoft is using a real Linux kernel and no longer running a translation layer for system calls.
Update your distribution
If you already have Linux installed for WSL 1.0, you can update it to 2.0 so it can take advantage of all the new features using the commands:
wsl -l -v
This will list out all your Linux installs.
You can then update them by name.
wsl --set-version Ubuntu 2
I recommend setting the default version to 2.0 for future installs.
wsl --set-default-version 2
Depending on how much you have used your Linux distribution, the conversion to 2.0 can take a little time.
Install a Linux distribution
If this is a new install of WSL, you can download your choice of Linux from the Microsoft Store.
Do a search for Linux in the Microsoft Store and this should bring up most of the options available.
I recommend Ubuntu 20.04 but you can choose any of the other options.
Once installed, it will prompt you to create a user.
Install Windows Terminal
I also recommend installing Windows Terminal. It is a beta product from Microsoft that allows you to easily launch Powershell, CMD, and Bash from the same terminal.
It also allows you to quickly start your Linux distribution, I typically will just use my SSH client but Linux is not started when Windows is started. So you need to initially start it and optionally SSH.
At this point, you are all set and can start using & developing Linux native applications within Windows.
WSL 2.0 is not a virtual machine (even though it does use a tiny virtual machine to bootstrap it). WSL is a full-blown Linux distribution running native Linux applications.
The performance of WSL 2.0 is amazing compared to WSL 1.0, in most cases, it is near-native speed now.
My next post will cover a cool feature that allows you to use WSL 2.0 to develop on Windows much easier than you thought possible.
Does it only work on Windows Pro or also on Windows Home?
In theory it would probably work. I haven't tested it but the way WSL works I wouldn’t recommend it.
There is no init system with WSL so you need to use Windows scheduler to start applications.
WSL also doesn’t stay running as well as a dedicated machine. Recently they added the ability to run background tasks even when closing shell but I wouldn’t use it for a service that needs to stay running. Especially when you spend 6hrs to 4 days to do a replay just to get it synced up.
I had to use "wsl -l --all" to list all Linux installations... "wsl -l -v" didn't work.
Also, to upgrade, I had to use "wsl --upgrade Ubuntu-18.04"
It should be minus L minus V for list and version.
The name is whatever your installation name is from the above command. That’s why I suggested listing the installations.
That's strange as wsl -l -v works for me.
Looks like they forgot to update some files in the 2004 update... I had to revert to older version of WSL and then reinstall updates to get "-l -v" to work... After the update to WSL 2.0, clock runs backwards inside Ubuntu... lol... maybe they add a fix for that too...
I did notice there are some known issues with 2004.
See if you can install chrony to keep track of your clock.
sudo apt install chrony
To be honest, I am not happy with version 2004 at all.
Chrony didn't help... I reverted back to WSL 1... Maybe all the issues will be eventually fixed, but as I need to build applications on daily basis, I can't take risks even if the drift is just fractions of a second right after starting the session.
That's odd, I didn't see that in the known issues. Most of the known issues were very obscure.
I used to be beta tester for Microsoft, so I know a few things about how to break things... WSL 2 doesn't like saving files to NTFS mount. I use NTFS mounts so I can do builds from same source tree for both Windows and Ubuntu...
Great, thanks for sharing. However, I'm more interested on the opposite...What software you reccomend to install for running windows apps on a linux distro?
I don't typically do that, but I would recommend running a Windows Virtual Machine, but if you want to install directly then WINE is probably the best option. I would do what I could to replace Windows apps with native Linux ones if at all possible.
If it is games, there is a new game project that is gaining success, forget the name but shouldn't be too hard to find.
Proton.
https://www.computerworld.com/article/3561635/bumps-on-the-road-to-the-win10-version-2004-rollout.html
I'll wait a bit.
I agree. I'm having regrets myself. I've been wanting off Windows so bad since 10 but neither option really works.
It looks like your post got attacked by an army of angry vikings!
Just two, minimalpris and his 490 account bot army, and about 8-10 from lokiyngling.
Wow, very interesting incoming voting patterns on that first one!
WSL sorta reminds me of LSL. Who remembers Leisure Suit Larry???? 😍