I cannot update Linux Kernel

So I need the version >= 4.19.121 to be able to use CUDA in WSL2, I’m trying to update the kernel but I have no luck. When I do wsl --status on PowerShell I get this


but when I do uname -r in a WSL window I get this:


What I can do?

For CUDA in WSL2 you need Windows 11 or a insider preview. Which Windows buid are you running? (run winver.exe)


I see. Open an elevated cmd and run

wsl.exe --shutdown
wsl.exe --update

next time you open WSL2 it should load with the latest kernel.

I already did that


The output for uname -r should be
If you don’t see that try rebooting Windows and if still doesn’t work you will need to uninstall the WSL2 update in Add/Remove apps and call wsl.exe --update again.

I had to recompile the kernel. In case anyone got into the same problem

git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
code .config
paste in https://raw.githubusercontent.com/microsoft/WSL2-Linux-Kernel/master/Microsoft/config-wsl
make olddefconfig
make -j $(nproc)
cp arch/x86_64/boot/bzImage /mnt/c/Users/myuser/kernel5
in windows edited
code /Users/jimh/.wslconfig
wsl --shutdown Ubuntu-20.04

Well, of course, if you were using a custom kernel then no matter how many times you call wsl.exe --update you will always have same custom kernel version.