How to Upgrade from WSL Version 1 to WSL Version 2
This is a post on how to upgrade a Windows Subsystem for Linux (WSL) Distribution from running on Version 1 to Version 2.
WSL has two versions, the latest (2), and the original version (1). You can have many different Linux Distributions installed on your machine, and you can easily change the WSL Version of one of them.
This Microsoft documentation page explains the key differences between versions and will help explain why you might want to downgrade back to version 1 for your particular WSL development needs.
This post is to help guide you on upgrading from WSL Version 1 to WSL Version 2. If you are looking to go the other way and downgrade from WSL Version 2 to WSL Version 1, see our other post here.
How to Upgrade from WSL V1 to V2
To upgrade a WSL Distributions from WSL Version 1 to Version 2, we run the wsl command followed by the –set-version parameter.
We are also listing the installed Linux Distros in this demo to display the versions before and after.
# check wsl distro versions wsl -l -v # change wsl distro using name above to desired version wsl --wsl-version Ubuntu 2
We’re running wsl -l -v to list the installed Linux Distros again to verify the change.
For more information on the wsl command options, have a look at the Microsoft Documentation page here.