18

I installed WSL 2 with Ubuntu 22.04.

When I try to check the WSL kernel in PowerShell, I am getting this result:

PS C:\Users\user> wsl --status
Default Distribution: Ubuntu-22.04
Default Version: 2

Windows Subsystem for Linux was last updated on 6/7/2022
WSL automatic updates are on.

Kernel version: 5.10.102.1

From the above message, I am assuming that I am using Linux kernel 5.10.102.1.

But when I run Ubuntu and use uname -a, I am getting a different Linux kernel:

user@DESKTOP-:/mnt/c/Users/user$ uname -a
Linux DESKTOP-VMP6T3Q 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

Which says that the Linux kernel is 4.4.0.

My questions:

  1. Which version of Linux kernel am I using?
  2. If it is 4.4.0, How can I upgrade it to 5.x?
  3. If it is 5.10, how can I check to make sure that it is that version?
NotTheDr01ds
  • 17,574
  • 4
  • 44
  • 81
mans
  • 447
  • 1
  • 7
  • 15

2 Answers2

20

While WSL2 is the default for new distributions that you install, it appears that your Ubuntu distribution was originally installed as WSL1.

You can confirm this with:

wsl.exe -l -v

When running uname -a under WSL1, the pseudo-kernel will report as:

  • "Linux"
  • The hostname
  • "4.4.0-"
  • The Windows build number (19041 in your case)
  • "-Microsoft"
  • ...

Under WSL2, the kernel will report as:

  • "Linux"
  • The hostname
  • The kernel version
  • "-microsoft-standard-WSL2"

It's quite common for a distribution to be installed before WSL2 was installed or set as default. Changing the default version to 2 doesn't actually change the already-installed distribution.

You can (and should) convert the distribution by exiting the distribution, then from PowerShell:

wsl --set-version Ubuntu-22.04 2

If you want to, you can back it up first with:

wsl --export Ubuntu-22.04 Ubuntu2204_backup.tar

I say "should" because Ubuntu 22.04 has some significant issues under WSL1, specifically the unzip command doesn't work.

NotTheDr01ds
  • 17,574
  • 4
  • 44
  • 81
7

While the default WSL version is set to 2, the WSL distribution you are running is WSL 1. It does not use a Linux kernel at all.

WSL 1 (Windows 10):

$ uname -a
Linux db-d-18 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 GNU/Linux

WSL 2:

# uname -a
Linux db-d-18 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 GNU/Linux

WSL 1 and 2 serve different needs. WSL 1 offers high-performance interop of Windows software and files. WSL 2 offers a real Linux kernel, enabling containers and faster Linux filesystems, among others, at the cost of limited performance when accessing the Windows host’s filesystems.

You should generally not base your selection on the kernel version.

Daniel B
  • 60,360
  • 9
  • 122
  • 163