WSL

Update WSL2 (Windows Subsystem for Linux) kernel on Windows

· 2 min read
How to Update WSL2 (Windows Subsystem for Linux) kernel on Windows

Windows Build version 20150 has introduced command line options to update WSL2 (Windows Subsystem for Linux) Kernel very conveniently. Let's try that.

Run wmic os get BuildNumber in command line to check the build version of your Windows.

C:\Users\AwsJunkie>wmic os get BuildNumber
BuildNumber
22000

Check Kernel version of Windows Subsystem for Linux (e.g. Kernel version: 5.10.16).

C:\Users\AwsJunkie>wsl --status
Default Distribution: Ubuntu
Default Version: 2

Windows Subsystem for Linux was last updated on 2022-09-02
WSL automatic updates are on.

The WSL 2 kernel is in the rollback state and is using a previous kernel version.
Kernel version: 5.10.16

If WSL automatic updates are enabled then it will be updated automatically by Windows Update. Otherwise, you can execute wsl --update in command line to trigger the WSL2 kernel update. It'll download and install the latest version.

C:\Users\AwsJunkie>wsl --update
Checking for updates...
Downloading updates...
Installing updates...
This change will take effect on the next full restart of WSL. To force a restart, please run 'wsl --shutdown'.
Kernel version: 5.10.102.1

Change will be effective, once all running Linux Distros and WSL2 VM are terminatd. Run wsl --shutdown to do the same. And verify the kernel version (e.g. 5.10.102.1) using wsl --status.

C:\Users\AwsJunkie>wsl --shutdown
C:\Users\AwsJunkie>wsl --status
Default Distribution: Ubuntu
Default Version: 2

Windows Subsystem for Linux was last updated on 2022-09-11
WSL automatic updates are on.

Kernel version: 5.10.102.1

If WSL2 kernel is already upto date then you see something like below.

C:\Users\AwsJunkie>wsl --update
Checking for updates...
No updates are available.
Kernel version: 5.10.102.1

Usage of wsl --update

C:\Users\Abhimun>wsl --help
Copyright (c) Microsoft Corporation. All rights reserved.

Usage: wsl.exe [Argument] [Options...] [CommandLine]

Arguments for running Linux binaries:

    --update [Options]
        If no options are specified, the WSL 2 kernel will be updated
        to the latest version.

        Options:
            --rollback
                Revert to the previous version of the WSL 2 kernel.

It also comes with an easy option to rollback to previous version (e.g. Kernel version: 5.10.16) of the WSL2 kernel by running wsl --update --rollback in command prompt ("Run as administrator")

C:\WINDOWS\system32>wsl --update --rollback
Rollback successful.
This change will take effect on the next full restart of WSL. To force a restart, please run 'wsl --shutdown'.
Kernel version: 5.10.16

References