nvidia-smi
error
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver
Reason: the Ubuntu kernel has been updated, which is inconsistent with the kernel when the graphics card driver was installed
Solution 1
reduce the system kernel, select low kernel in the boot preference, or change the configuration file to automatically select low version kernel by default boot. Refer to the link for the method
Solution 2
update the graphics card driver
view the installed driver version
ls /usr/src
Display my graphics driver for nvidis-470 reinstall updated graphics driver
sudo apt install --reinstall nvidia-driver-470
After the update is successful, restart the computer
nvidia-smi
It can be displayed normally
Thu Mar 24 10:18:37 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.103.01 Driver Version: 470.103.01 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A |
| N/A 37C P0 N/A/ N/A | 439MiB/ 4046MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 3149 G /usr/lib/xorg/Xorg 193MiB |
| 0 N/A N/A 3314 G /usr/bin/gnome-shell 70MiB |
| 0 N/A N/A 4010 G /usr/lib/firefox/firefox 171MiB |
+-----------------------------------------------------------------------------+