Failed to initialize NVML: Driver/library version mismatch

Ubuntu 21.04

nvidia-smi >> Failed to initialize NVML: Driver/library version mismatch

lspci -v | grep VGA >> 1d:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 3GB] (rev a1) (prog-if 00 [VGA controller])

I do not know how to generate logs. I need help on where/how to troubleshoot and potentially fix this.

run nvidia-bug-report.sh as root and attach the resulting file here.

Failed to initialize NVML: Driver/library version mismatch

As the message says, the kernel modules and the libraries have different versions.

Attached.

nvidia-bug-report.log.gz (149.5 KB)

Sep 29 09:57:22 ubuntu kernel: [ 9996.759866] NVRM: API mismatch: the client has the version 470.74, but
Sep 29 09:57:22 ubuntu kernel: [ 9996.759866] NVRM: this kernel module has the version 470.63.01. Please
Sep 29 09:57:22 ubuntu kernel: [ 9996.759866] NVRM: make sure that this kernel module and all NVIDIA driver
Sep 29 09:57:22 ubuntu kernel: [ 9996.759866] NVRM: components have the same version.

Run sudo apt purge nvidia* libnvidia*.
Then sudo apt install nvidia-driver-470.

If that is not working, then show the output of: dkms status

DKMS: install completed.
Setting up libnvidia-encode-470:amd64 (470.74-0ubuntu0.21.04.1) …
Setting up nvidia-driver-470 (470.74-0ubuntu0.21.04.1) …
Processing triggers for desktop-file-utils (0.26-1ubuntu1) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for libc-bin (2.33-0ubuntu5) …
Processing triggers for man-db (2.9.4-2) …
Processing triggers for mailcap (3.68ubuntu1) …
Processing triggers for initramfs-tools (0.139ubuntu3) …
update-initramfs: Generating /boot/initrd.img-5.11.3-051103-generic

nvidia-smi>>Failed to initialize NVML: Driver/library version mismatch

dkms status>>nvidia, 470.74, 5.11.3-051103-generic, x86_64: installed

Did you reboot?

ah ha, that did it! thanks!