Apparent discrepancy between declared kernel version and boot entries

Running Ubuntu under wsl. Issuing wsl.exe --status in Windows (11) returns

Default Distribution: Ubuntu-22.04
Default Version: 2
Windows Subsystem for Linux was last updated on 27-Mar-22
WSL automatic updates are on.
Kernel version: 5.10.102.1

and uname -r from within Ubuntu says 5.10.102.1-microsoft-standard-WSL2. But the /boot directory contains

drwxr-xr-x 3 root root 4096 May 4 20:29 ./
drwxr-xr-x 19 root root 4096 May 4 21:01 ../
-rw-r--r-- 1 root root 260489 Apr 14 08:46 config-5.15.0-27-generic
-rw-r--r-- 1 root root 261613 Apr 27 14:06 config-5.15.0-28-generic
-rw-r--r-- 1 root root 261233 May 3 14:20 config-5.15.0-29-generic
drwxr-xr-x 2 root root 4096 Apr 19 14:05 grub/
lrwxrwxrwx 1 root root 28 May 4 20:29 initrd.img -> initrd.img-5.15.0-29-generic
-rw-r--r-- 1 root root 118149011 May 4 20:29 initrd.img-5.15.0-27-generic
-rw-r--r-- 1 root root 118191763 May 4 20:28 initrd.img-5.15.0-28-generic
-rw-r--r-- 1 root root 118173389 May 4 20:29 initrd.img-5.15.0-29-generic
lrwxrwxrwx 1 root root 28 May 4 20:29 initrd.img.old -> initrd.img-5.15.0-28-generic
-rw-r--r-- 1 root root 182800 Feb 7 00:35 memtest86+.bin
-rw-r--r-- 1 root root 184476 Feb 7 00:35 memtest86+.elf
-rw-r--r-- 1 root root 184980 Feb 7 00:35 memtest86+_multiboot.bin
-rw------- 1 root root 6241791 Apr 14 08:46 System.map-5.15.0-27-generic
-rw------- 1 root root 6248105 Apr 27 14:06 System.map-5.15.0-28-generic
-rw------- 1 root root 6248105 May 3 14:20 System.map-5.15.0-29-generic
lrwxrwxrwx 1 root root 25 May 4 20:29 vmlinuz -> vmlinuz-5.15.0-29-generic
-rw------- 1 root root 11064224 Apr 14 08:47 vmlinuz-5.15.0-27-generic
-rw------- 1 root root 11081440 Apr 27 16:32 vmlinuz-5.15.0-28-generic
-rw------- 1 root root 11081856 May 3 14:32 vmlinuz-5.15.0-29-generic
lrwxrwxrwx 1 root root 25 May 4 20:29 vmlinuz.old -> vmlinuz-5.15.0-28-generic

which seemingly indicates that the current kernel version is 5.15.0-29.

How to understand this?

And by the way, can I delete the -27 and -28 entries?

1 Answer

/boot is not actually used under WSL2. If you have kernels in /boot, it seems like you may have installed them via sudo apt install linux-image... or perhaps they were installed as a dependency of another package? Mine is empty by default on WSL2 (22.04) (and all of my other distros as well), and only populated once I manually installed a different kernel image just now for testing.

Keep in mind that Ubuntu on WSL2 is really running inside a VM that you don't have access to (the "Virtual Machine Platform" feature in Windows). This VM is what provides the kernel, and then Ubuntu is run in a "namespace" inside that VM. If you were to install 18.04, 20.04, and 22.04 in WSL2, they'd all use the same WSL2 kernel rather than the stock Ubuntu kernels.

If you want to clean them up, best to use sudo apt remove linux-image... followed by sudo apt autoremove, I would think. If that doesn't work, I think we'll need to figure out what package installed them as a dependency.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like