How to upgrade from WSL 1 to WSL 2
WSL is a very powerful tool to allow developers to use Linux features on Windows machines. The latest version is WSL 2.WSL 2 uses the latest virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). For more information about WSL 1 and 2 differences, refer to Comparing WSL 1 and WSL 2 | Microsoft Docs.
Upgrade from WSL 1 to 2
Run the following command will show the current installed distros:
wsl -l -v
The command prints out the distros with versions in my Windows machine:
As shown in the above screenshot, I have multiple different versions of distro installed.
To upgrade from WSL1 to WSL2, we can simply run the following command:
wsl --set-version <distro name> 2
For example, the following command upgrade my Ubuntu-18.04 distro to WSL 2.
wsl --set-version Ubuntu-18.04 2