Failed to initialize NVML: Driver/library version mismatch

I am an ubuntu system. I downloaded the graphics card driver from the official website of Nvidia and performed the installation operation. After entering nvidia-smi, “Failed to initialize NVML: Driver/library version mismatch” appeared. I also read some posts, but it still has not been resolved problem, can you help me?

ubuntu:20.04.1
nvidia:NVIDIA-Linux-x86_64-515.86.01.run

rebooting doesn’t help me
nvidia-bug-report.log.gz (98.6 KB)

can someone come and help me?

is the way I asked the question wrong? or is this forum no longer maintained?

You should not mix the .run file installation with the distro installation.
In general it’s better to use the distro packages, or use the graphics-drivers ppa.
Proprietary GPU Drivers : “Graphics Drivers” team, than the .run file installer.

First run the .run file installer with the --uninstall flag again.
Then do

sudo apt purge -s "nvidia*" "libnvidia*"

and install the distro package after.

thank goodness, there is finally a reply, the driver of the specified version cannot be found through the command ‘sudo apt install nvidia-driver-515.65.01’, my code needs ‘515.65.01’ driver, and the same ubuntu (20.04.1) system , with the same kernel (5.13.0-32-generic), I installed the 515.65.01 graphics card driver through the .run file. I successfully executed it on one machine, but a problem occurred when I changed a machine with the same configuration. This one point confuses me

I executed the following command, but still reported an error, Failed to initialize NVML: Driver/library version mismatch

sudo ./NVIDIA-Linux-x86_64-515.86.01.run --uninstall

sudo apt purge -s "nvidia*" "libnvidia*"

sudo apt install nvidia-driver-515

nvidia-smi

you need to reboot after the driver installation.

Sorry, you need to omit the -s parameter. I forgot to remove it.

thank you for your reply, I operate according to the latest suggestion, and the previous error is still reported after restarting

dkms status:

nvidia, 515.105.01, 5.13.0-32-generic, x86_64: installed

dpkg -l |grep nvidia:

ii  libnvidia-cfg1-515:amd64                        515.105.01-0ubuntu1                 amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-515                            515.105.01-0ubuntu1                 all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-515:amd64                     515.105.01-0ubuntu1                 amd64        NVIDIA libcompute package
ii  libnvidia-compute-515:i386                      515.105.01-0ubuntu1                 i386         NVIDIA libcompute package
ii  libnvidia-decode-515:amd64                      515.105.01-0ubuntu1                 amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-515:i386                       515.105.01-0ubuntu1                 i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-515:amd64                      515.105.01-0ubuntu1                 amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-515:i386                       515.105.01-0ubuntu1                 i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-515:amd64                       515.105.01-0ubuntu1                 amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-515:amd64                        515.105.01-0ubuntu1                 amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-515:i386                         515.105.01-0ubuntu1                 i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-515:amd64                          515.105.01-0ubuntu1                 amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-515:i386                           515.105.01-0ubuntu1                 i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  nvidia-compute-utils-515                        515.105.01-0ubuntu1                 amd64        NVIDIA compute utilities
ii  nvidia-dkms-515                                 515.105.01-0ubuntu1                 amd64        NVIDIA DKMS package
ii  nvidia-driver-515                               515.105.01-0ubuntu1                 amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-515                        515.105.01-0ubuntu1                 amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-515                        515.105.01-0ubuntu1                 amd64        NVIDIA kernel source package
ii  nvidia-prime                                    0.8.16~0.20.04.2                    all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                                 530.30.02-0ubuntu1                  amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-515                                515.105.01-0ubuntu1                 amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                         0.18build1                          all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-515                   515.105.01-0ubuntu1                 amd64        NVIDIA binary Xorg driver

ls -l /usr/lib/x86_64-linux-gnu/nvidia:

lrwxrwxrwx 1 root root       27 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.0 -> libEGL_nvidia.so.515.105.01
-rw-r--r-- 1 root root  1329168 2月  27 20:42 /usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.515.105.01
lrwxrwxrwx 1 root root       33 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libGLESv1_CM_nvidia.so.1 -> libGLESv1_CM_nvidia.so.515.105.01
-rw-r--r-- 1 root root    67880 2月  27 20:41 /usr/lib/x86_64-linux-gnu/libGLESv1_CM_nvidia.so.515.105.01
lrwxrwxrwx 1 root root       30 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libGLESv2_nvidia.so.2 -> libGLESv2_nvidia.so.515.105.01
-rw-r--r-- 1 root root   117032 2月  27 20:41 /usr/lib/x86_64-linux-gnu/libGLESv2_nvidia.so.515.105.01
lrwxrwxrwx 1 root root       27 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.0 -> libGLX_nvidia.so.515.105.01
-rw-r--r-- 1 root root  1289552 2月  27 20:40 /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.515.105.01
lrwxrwxrwx 1 root root       24 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so -> libnvidia-allocator.so.1
lrwxrwxrwx 1 root root       33 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.1 -> libnvidia-allocator.so.515.105.01
-rw-r--r-- 1 root root   143848 2月  27 20:39 /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.515.105.01
lrwxrwxrwx 1 root root       18 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so -> libnvidia-cfg.so.1
lrwxrwxrwx 1 root root       27 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.1 -> libnvidia-cfg.so.515.105.01
-rw-r--r-- 1 root root   246128 2月  27 20:39 /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.515.105.01
-rw-r--r-- 1 root root 56227320 2月  27 21:10 /usr/lib/x86_64-linux-gnu/libnvidia-compiler.so.515.105.01
-rw-r--r-- 1 root root 33855408 2月  27 21:07 /usr/lib/x86_64-linux-gnu/libnvidia-eglcore.so.515.105.01
lrwxrwxrwx 1 root root       26 6月   5 17:47 /usr/lib/x86_64-linux-gnu/libnvidia-egl-gbm.so.1 -> libnvidia-egl-gbm.so.1.1.0
-rw-r--r-- 1 root root    22656 2月  27 20:42 /usr/lib/x86_64-linux-gnu/libnvidia-egl-gbm.so.1.1.0
lrwxrwxrwx 1 root root       21 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-encode.so -> libnvidia-encode.so.1
lrwxrwxrwx 1 root root       30 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 -> libnvidia-encode.so.515.105.01
-rw-r--r-- 1 root root   116768 2月  27 20:40 /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.515.105.01
lrwxrwxrwx 1 root root       18 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-fbc.so -> libnvidia-fbc.so.1
lrwxrwxrwx 1 root root       27 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-fbc.so.1 -> libnvidia-fbc.so.515.105.01
-rw-r--r-- 1 root root   133816 2月  27 20:39 /usr/lib/x86_64-linux-gnu/libnvidia-fbc.so.515.105.01
-rw-r--r-- 1 root root 36771312 2月  27 21:08 /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.515.105.01
-rw-r--r-- 1 root root   643976 2月  27 20:40 /usr/lib/x86_64-linux-gnu/libnvidia-glsi.so.515.105.01
-rw-r--r-- 1 root root 16700088 2月  27 21:18 /usr/lib/x86_64-linux-gnu/libnvidia-glvkspirv.so.515.105.01
lrwxrwxrwx 1 root root       17 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-ml.so -> libnvidia-ml.so.1
lrwxrwxrwx 1 root root       26 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 -> libnvidia-ml.so.515.105.01
-rw-r--r-- 1 root root  1683960 2月  27 20:41 /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.515.105.01
lrwxrwxrwx 1 root root       27 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-ngx.so.1 -> libnvidia-ngx.so.515.105.01
-rw-r--r-- 1 root root  3310152 2月  27 20:42 /usr/lib/x86_64-linux-gnu/libnvidia-ngx.so.515.105.01
lrwxrwxrwx 1 root root       19 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-nvvm.so -> libnvidia-nvvm.so.4
lrwxrwxrwx 1 root root       28 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-nvvm.so.4 -> libnvidia-nvvm.so.515.105.01
-rw-r--r-- 1 root root 85730624 2月  27 21:25 /usr/lib/x86_64-linux-gnu/libnvidia-nvvm.so.515.105.01
lrwxrwxrwx 1 root root       30 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1 -> libnvidia-opencl.so.515.105.01
-rw-r--r-- 1 root root 16319176 2月  27 21:10 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.515.105.01
lrwxrwxrwx 1 root root       26 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-opticalflow.so -> libnvidia-opticalflow.so.1
lrwxrwxrwx 1 root root       35 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-opticalflow.so.1 -> libnvidia-opticalflow.so.515.105.01
-rw-r--r-- 1 root root    47088 2月  27 20:41 /usr/lib/x86_64-linux-gnu/libnvidia-opticalflow.so.515.105.01
lrwxrwxrwx 1 root root       29 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so -> libnvidia-ptxjitcompiler.so.1
lrwxrwxrwx 1 root root       38 2月  28 00:44 /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.1 -> libnvidia-ptxjitcompiler.so.515.105.01
-rw-r--r-- 1 root root 11488760 2月  27 20:46 /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.515.105.01
-rw-r--r-- 1 root root 81405472 2月  27 21:28 /usr/lib/x86_64-linux-gnu/libnvidia-rtcore.so.515.105.01
-rw-r--r-- 1 root root    18456 2月  27 20:39 /usr/lib/x86_64-linux-gnu/libnvidia-tls.so.515.105.01
lrwxrwxrwx 1 root root       38 6月   5 16:02 /usr/lib/x86_64-linux-gnu/libnvidia-vulkan-producer.so -> libnvidia-vulkan-producer.so.515.86.01

/usr/lib/x86_64-linux-gnu/nvidia:
总用量 4
drwxr-xr-x 2 root root 4096 6月   5 17:47 xorg

nvidia-bug-report.sh:
nvidia-bug-report.log (1.6 MB)

Does the command
find /usr/lib -iname "*510.47.03*"

return the old libaries?

Also you should have used the 510.47.03 .run file installer.

there is no output from this command

i re-downloaded the ‘515.86.01’ driver and executed the following command, but the error is still reported: ‘Failed to initialize NVML: Driver/library version mismatch’, what should i do now?

sudo ./NVIDIA-Linux-x86_64-510.47.03.run --uninstall
sudo ./NVIDIA-Linux-x86_64-515.86.01.run --uninstall
sudo apt purge “nvidia*” “libnvidia*”
sudo apt install nvidia-driver-515
reboot
nvidia-smi

~# find / -name “nvidia” -print

do i need to delete the found remnants of the 510 graphics card driver? Here is the log
log.txt (25.7 KB)

my problem was finally solved, i deleted all 510 driver residues, nvidia-smi can be displayed normally,thank you for your reply

Every time I have this issue on a Red Hat machine it is because the kernel modules from an old nvidia installation are still packaged in the initramfs.

Check if the modules are there: lsmod | grep -i nvidia
Remove the modules: rmmod nvidia_drm | rmmod nvidia_modeset | rmmod nvidia
Backup initramfs: mv /boot/initramfs-$(uname -r).img{,.bak}
Create new initramfs: dracut -f -v
Reboot and install the driver