Quantcast
Channel: Can Windows 10 have WSL1 & WSL2? - Super User
Viewing all articles
Browse latest Browse all 2

Answer by Gray for Can Windows 10 have WSL1 & WSL2?

$
0
0

Yes. Windows 10 can have both WSL1 and WSL2 active.

After exploring the Basic Commands for WSL at Microsoft I learned the Windows sub-system version of Linux can be easily converted from WSL1 to WSL2 or Vice versa.

https://docs.microsoft.com/en-us/windows/wsl/basic-commands

Below demonstrates how Ubuntu (or other distros) can be converted from WSL1-WSL2 and back and forth. All commands were commands given in the Windows Terminal (the new PowerShell). The PowerShell command(s) to convert are:

wsl --set-version ubuntu 1wsl --set-version ubuntu 2

Ubuntu was (just) reinstalled (again) from the Microsoft Store. The User name and Password were created. No sudo update/upgrades were done (yet). The WSL status was checked and showed the newly installed (running) Ubuntu was installed as WSL2.

PS C:\Users\prior> wsl --list --verbose
NAMESTATEVERSION
docker-desktop-dataStopped2
docker-desktopStopped2
UbuntuRunning2

Then Ubuntu was converted from WSL2 to WSL1. The status was checked again. This showed Ubuntu converted to WSL1 and stopped.

  PS C:\Users\prior> wsl --set-version ubuntu 1

Conversion in progress, this may take a few minutes... Conversioncomplete.

  PS C:\Users\prior> wsl --list --verbose
NAMESTATEVERSION
docker-desktop-dataStopped2
docker-desktopStopped2
UbuntuStopped1

Ubuntu was restarted from the Windows start apps list. The WSL status was checked again. The status returned showing Ubuntu was running as WSL1. The Docker apps were still WSL2.

PS C:\Users\prior> wsl --list --verbose
NAMESTATEVERSION
docker-desktop-dataStopped2
docker-desktopStopped2
UbuntuRunning1

Docker was started and the WSL status checked. It becomes clear that both WSL1 and WSL2 files can be active and running in Windows 10.

PS C:\Users\prior> wsl --list --verbose
NAMESTATEVERSION
docker-desktop-dataRunning2
docker-desktopRunning2
UbuntuRunning1

Then for the sake of curiosity, Ubuntu was converted back to WSL2 and then started. The status was checked and showed the conversion to WSL2 worked. Ubuntu and Docker are WSL2 and running.

PS C:\Users\prior> wsl --set-version ubuntu 2

Conversion in progress, this may take a few minutes... For informationon key differences with WSL 2 please visit https://aka.ms/wsl2Conversion complete.

PS C:\Users\prior> wsl --list --verbose
NAMESTATEVERSION
docker-desktop-dataRunning2
docker-desktopRunning2
UbuntuRunning2

It seems clear that it was unnecessary to uninstall and reinstall Linux whenever switching the sub-system for WSL1 or WSL2.


Viewing all articles
Browse latest Browse all 2

Trending Articles