How to update from WSL to WSL 2 in Windows 10

How to update from WSL to WSL 2 in Windows 10

WSL 2 (Windows Subsystem for Linux 2) is a new version of the architecture in WSL that changes the way Linux distributions interact with Windows. This guide will show you how to update from Windows Subsystem for Linux (WSL) to WSL 2 in Windows 10.

How to update from WSL to WSL 2 in Windows 10

1. Open PowerShell as admin.

2. Copy and paste the command below into PowerShell, and then press Enter to enable the WSL optional feature.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Turn on the optional WSL feature

3. Copy and paste the command below into PowerShell, and then press Enter to enable the Virtual Machine Platform option .

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Enable the Virtual Machine Platform option

4. Restart the computer to apply the change.

5. Open PowerShell as admin.

6. Copy and paste the following command into PowerShell, and then press Enter to set WSL 2 as the default version used when installing new Linux distributions.

wsl --set-default-version 2

You can see this message after running the above command:

WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel.

(WSL 2 requires kernel component update. For information please visit https://aka.ms/wsl2kernel).

If you want, click on the link (https://aka.ms/wsl2kernel) and install MSI from that site on the Microsoft documentation to install the Linux kernel on your machine and use WSL 2. After you have installed it. kernel, please run the command again: wsl –set-default-version 2 and it should complete successfully without displaying a message.

Updating from WSL 1 to WSL 2 may take several minutes to complete, depending on the size of the targeted distribution. If you are running an old WSL 1 installation from the Windows 10 Anniversary Update or the Creators Update, you may encounter an update error.

Set WSL 2 as the default version used when installing new Linux distributions

7. You can now install and set WSL distro apps from the Microsoft Store to use WSL 2 by default.

See more:

  • How to run a Linux desktop using Windows Subsystem for Linux
2