How to upgrade from WSL 1 to WSL 2

Raymond Raymond event 2022-02-09 visibility 5,749
more_vert

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:

2022020983316-image.png

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
It make takes a few minutes to complete.
Once it is done, you can use list command `wsl -l -v` to check the version. 
More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts