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 upgrade for your particular WSL development needs. If you’re not going to be using advanced WSL features, then this is the best step if you notice you are on version 1.
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 my 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.
The first command below, wsl -l -v, is used to check the version of WSL as described in my other post – How to Check WSL Version
# check wsl distro versions wsl -l -v # change wsl distro using name above to desired version wsl --set-version Debian 2
The second command in this demo has upgraded the Debian distribution to Version 2.
To downgrade back to version 1, it’s as simple as changing the number from a 2 to a 1 in the command. I’ve created a post on it if it helps to switch pages.