Table of Contents
Windows Subsystem for Linux WSL1
This post explains how to upgrade from WSL 1 to WSL 2 on Windows 10 and 11. Please note that WSL 2 is only available on:
- Windows 11
- Windows 10, version 1903, build 18362 or later.
The main reasons to upgrade from WSL 1 to WSL 2 include increased file system performance and full system call compatibility.
Get the list of installed distributions:
wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1
Debian Stopped 1
Enable Virtual Machine Platform
1. First, you need enable Virtual Machine Platform in order to run WSL 2. You can enable it using PowerShell or using Turn on Windows Features.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19043.2075
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
Restart Windows to complete this operation.
Do you want to restart the computer now? (Y/N)
2. Once done, restart your computer to take the changes go into effect.
Install the Linux kernel update package
The Linux kernel in WSL 2 is built by Microsoft from the latest stable branch, based on the source available at kernel.org. This kernel has been specially tuned for WSL 2, optimizing for size and performance to provide an amazing Linux experience on Windows.
Let’s download then install the Linux kernel update package https://aka.ms/wsl2kernel
Or it can be done using PowerShell:
msiexec /i https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi /qn
Set default version
Open PowerShell and run this command to set WSL 2 as the default version when installing a new Linux distribution:
wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation completed successfully.
Now, you can use the command wsl –list –online to obtain a list of available distributions for installation.
wsl -l -o
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-16.04 Ubuntu 16.04 LTS
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
PS C:\> wsl --install -d kali-linux
Downloading: Kali Linux Rolling
Installing: Kali Linux Rolling
Kali Linux Rolling has been installed.
Launching Kali Linux Rolling...
PS C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1
kali-linux Installing 2
Debian Stopped 1
Then install a distro using wsl –install command.
wsl --install -d kali-linux
Downloading: Kali Linux Rolling
Installing: Kali Linux Rolling
Kali Linux Rolling has been installed.
Launching Kali Linux Rolling...
PS C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1
kali-linux Installing 2
Debian Stopped 1
If you’ve version 1 installed distros, you can upgrade them to version 2 using –set-default parameter.
wsl --set-version ubuntu 2
PS C:\> wsl --set-version ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
PS C:\> wsl --set-version debian 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
PS C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
kali-linux Stopped 2
Debian Stopped 2
Alternatively
In some cases, you can simply upgrade WSL 1 to WSL 2 using this command.
PS C:\> wsl --update
Checking for updates...
Downloading updates...
Installing updates...
This change will take effect on the next full restart of WSL.
Kernel version: 5.10.102.1
Not a reader? Watch this related video tutorial:
Beautiful, Thanks!