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 nvidialibnvidia-cfg1-390:amd64 installlibnvidia-common-390 installlibnvidia-compute-390:amd64 installlibnvidia-compute-418-server:amd64 deinstalllibnvidia-decode-390:amd64 installlibnvidia-encode-390:amd64 installlibnvidia-fbc1-390:amd64 installlibnvidia-gl-390:amd64 installlibnvidia-ifr1-390:amd64 installnvidia-compute-utils-390 installnvidia-dkms-390 installnvidia-driver-390 installnvidia-kernel-common-390 installnvidia-kernel-source-390 installnvidia-prime installnvidia-settings installnvidia-utils-390 installxserver-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 :/