2

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 :/

1
  • It might be a version mismatch
    – Saxtheowl
    Mar 19 at 1:39

1 Answer 1

2

You can try to remove completely the existing Nvidia Drivers and reinstall a proper version

first purge the Nvidia drivers

sudo apt-get purge '^nvidia.*'
sudo rm -rf /etc/X11/xorg.conf
sudo rm -rf /etc/modprobe.d/nvidia*
sudo rm -rf /usr/local/nvidia*
sudo rm -rf /usr/lib/xorg/modules/drivers/nvidia*

then add the proper directories

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update

then install the good drivers sudo apt-get install nvidia-driver-470 then disable the nouveau drivers

sudo bash -c "echo 'blacklist nouveau' > /etc/modprobe.d/blacklist-nouveau.conf"
sudo bash -c "echo 'options nouveau modeset=0' >> /etc/modprobe.d/blacklist-nouveau.conf"

then update the initial ramdisk sudo update-initramfs -u

then reboot

if there is still error check sudo apt-get install nvidia-settings to be sure that all Component are upgraded correctly

4
  • 1
    Thanks for the detailed steps, however, it seems to not work, despite having a slightly different output ``` NVRM: API mismatch: the client has the version 520.61.05, but NVRM: this kernel module has the version 470.161.03. Please NVRM: make sure that this kernel module and all NVIDIA driver NVRM: components have the same version. ``` Mar 19 at 2:19
  • I am not sure if I have answered your question, you could try also by repeating the step and sudo apt-get install nvidia-driver to get sure to have the latest version
    – Saxtheowl
    Mar 19 at 3:23
  • Problem is that my nvidia graphic card is a legacy one (GT 740M) which I can only use max 470 nvidia driver Mar 19 at 3:26
  • I updated my answers, follow the step, I think I might not be able to help you if that does not fix your problem
    – Saxtheowl
    Mar 19 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.