Cuda_12.2.2_535.104.05_linux.run installation failed

I was installing cuda_12.2.2_535.104.05_linux.run, using the command posted by cuda, but encountered the following error:

sh: 1: dkms: not found
 Installation failed. See log at /var/log/cuda-installer.log for details.


this is my ubuntu version:

PS C:\Users\zhaoy> wsl --list --verbose
  NAME            STATE           VERSION
* Ubuntu-22.04    Running         2

This is the gcc version:

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

My first installation was successful, but the second installation kept failing here. It should be that the first file was not uninstalled cleanly. I used the method in Solution and couldn’t find any Nvidia-related files, so his method is correct. It doesn’t work for me, how should I proceed.

I’m really helpless, who can help me?