How to wsl update to version 2
- User
How to wsl update to version 2
- Assistant
How to wsl update to version 2
Updating Windows Subsystem for Linux (WSL) to version 2 (WSL 2) provides improved performance, full system call compatibility, and a real Linux kernel. Below are detailed steps to upgrade to WSL 2 on your Windows machine.
Operating System Requirements:
Enable Virtualization:
Windows Updates:
Execute the following command to enable the WSL feature:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
This feature is necessary for WSL 2:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
After enabling both features, restart your computer to apply the changes.
After restarting, open PowerShell as an administrator again and set WSL 2 as the default version:
wsl --set-default-version 2
Note: If you encounter an error stating that the WSL 2 kernel is not installed, proceed to Step 6.
Download and install the latest WSL 2 Linux kernel update package:
Download Link: WSL 2 Linux kernel update package for x64 machines
(For ARM64 machines, adjust the download link accordingly.)
Installation:
.msi file and follow the on-screen instructions to complete the installation.After installation, you can verify the WSL version by running:
wsl --list --verbose
This command will list all installed Linux distributions along with their corresponding WSL versions. The output should show version 2 for each distribution you have.
If you have existing WSL 1 distributions and want to upgrade them to WSL 2, use the following command:
wsl --set-version <distro-name> 2
Replace <distro-name> with the name of your distribution, e.g., Ubuntu.
Example:
wsl --set-version Ubuntu 2
To ensure that any new Linux distributions you install use WSL 2 by default, run:
wsl --set-default-version 2
Installing a Linux Distribution:
Accessing Linux Files:
%LOCALAPPDATA%\Packages.Updating WSL:
Using WSL Commands:
wsl --help in PowerShell to explore various options and functionalities.Error Enabling VirtualMachinePlatform:
WSL 2 Kernel Update Issues:
General Issues:
By following these steps, you should successfully upgrade to WSL 2, unlocking enhanced performance and compatibility for your Linux development workflows on Windows.
If you encounter any issues or have further questions, feel free to ask!
Not yet included in a published release.