I'm using a VM with Ubuntu 22.04 and trying to do GPU pass-through.
Nvidia graphic card is being detected on my VM
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
I did install the recommended nvidia drivers given by
ubuntu-drivers devices
Which is nvidia-drivers-390
However, when I run nvidia-smi it gives me
Failed to initialize NVML: Driver/library version mismatch
Further exploring the root cause I actually found
NVRM: API mismatch: the client has version 530.30.02, but
NVRM: this kernel module has version 390.157. Please
NVRM: make sure that this kernel module and all NVIDIA driver
NVRM: components have the same version.
However, my graphic card only supports up to nvidia-drivers-470 since it's a GT 740M graphic card. How can I remove the client API 530 version since it is not on the list of drivers installed?
dpkg --get-selections | grep nvidia
libnvidia-cfg1-390:amd64 install
libnvidia-common-390 install
libnvidia-compute-390:amd64 install
libnvidia-compute-418-server:amd64 deinstall
libnvidia-decode-390:amd64 install
libnvidia-encode-390:amd64 install
libnvidia-fbc1-390:amd64 install
libnvidia-gl-390:amd64 install
libnvidia-ifr1-390:amd64 install
nvidia-compute-utils-390 install
nvidia-dkms-390 install
nvidia-driver-390 install
nvidia-kernel-common-390 install
nvidia-kernel-source-390 install
nvidia-prime install
nvidia-settings install
nvidia-utils-390 install
xserver-xorg-video-nvidia-390 install
UPDATE:
I did find some folders using the following command
sudo find /usr/lib -iname "*nvidia*530*"
I removed and then followed the answer of @Saxtheowl and now there are Nvidia-520 files. Some witch craft for sure :/