After installing correct NVIDIA driver, nvidia-smi still can't find it. (Ubuntu 18.4)

12,032

If you purged nvidia drivers then reinstalled them you need to prime-select back-and-forth to intel then back to nvidia:

prime-select intel

prime-select nvidia

After this nvidia-smi should succeed.

Share:
12,032

Related videos on Youtube

whenitrains
Author by

whenitrains

Updated on September 18, 2022

Comments

  • whenitrains
    whenitrains over 1 year

    I'm trying to set up my system for CUDA by installing the lastest NVIDIA drivers. I've already installed the drivers, but still get an error when running nvidia-smi

    ~ nvidia-smi
    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
    

    After getting this message, I followed a few various tutorials, namely this one: Issues with Nvidia graphics driver and CUDA after apt-get upgrade\

    But when I try and purge the old drivers, I get an error:

    ~ sudo apt-get purge nvidia*                  
    zsh: no matches found: nvidia* (**EDIT**: THIS HAS BEEN FIXED, I CAN NOW PURGE, but that didn't help)
    

    Yet, I can't just install the most recent drivers, because they are already installed.

    ~ sudo apt-get install nvidia-driver-396
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    nvidia-driver-396 is already the newest version (396.54-0ubuntu0~gpu18.04.1).
    The following packages were automatically installed and are no longer required:
      libnvidia-common-390 libwayland-client0:i386 libwayland-server0:i386
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    

    I think my best bet at this point is still to delete and reinstall the driver, but I'm not sure how to do that. And I don't know why the driver isn't being used.

    Additional Notes:

     lsmod | grep nvidia
     dmesg | grep NVRM
    

    also return nothing.

    Why is the driver still not registered? Any help is appreciated.

    Edit I was able to purge the existing nvidia and try again, but it's still not working.

    It seems that the problem might be that nouveau isn't disabled properly.

    When I check which driver is being used:

    ➜  Documents sudo lshw -class video | grep driver=
           configuration: driver=nouveau latency=0
           configuration: driver=i915 latency=0
    

    So it's still there. I had used this site https://linuxconfig.org/how-to-disable-nouveau-nvidia-driver-on-ubuntu-18-04-bionic-beaver-linux to guide me through disabling it. Running the following command gives the expected result:

    ➜  Documents cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
    blacklist nouveau
    options nouveau modeset=0
    

    And it still doesn't work. Thoughts?

    • ubfan1
      ubfan1 over 5 years
      Try quoting your wildcard filenames in the purge, or using the explicit pacakge names. Anything blacklisting nvidia in /etc/modprobe.d/...?
    • whenitrains
      whenitrains over 5 years
      @ubfan1 It looks like something is blacklisting 'nvidiafb' could that be the culprit? Also thanks for the purge tip. Trying it now.
    • ubfan1
      ubfan1 over 5 years
      I have nvidiafb blacklisted too, so I guess that's not a problem. How did you install the Nvidia drivers the first time? I do it from the Software and Updates app from the Additional drivers tab. Works for me, then get CUDA, but I'm limited by hardware to CUDA 8.x.
    • whenitrains
      whenitrains over 5 years
      I might have found the problem (see first edit). Still don't know the solution.
    • ubfan1
      ubfan1 over 5 years
      The standard Nvidia driver install from the Additional Drivers tab should include a file, /etc/modprobe.d/nvidia-graphics-drivers.conf, in package nvidia-kernel-common-390 (the last number may vary), which contains the blacklist of nouveau and of lbm-nouveau, as well as aliases to "off' for both.
    • Terrance
      Terrance over 5 years
      In Ubuntu 18.04, CUDA now installs as sudo apt install nvidia-cuda-toolkit. You have the proper NVIDIA driver installation step. However, you haven't stated what video card you have. Please edit your question and add the output of inxi -G that should show what video card you have.
    • Terrance
      Terrance over 5 years
      Or, if inxi -G returns nothing, try running lspci | grep -i vga and add that to your question.
  • whenitrains
    whenitrains over 5 years
    I haven't yet. I'll see what I can find there. Thanks
  • whenitrains
    whenitrains over 5 years
    I've checked all over and tried two methods: linuxbabe.com/ubuntu/install-nvidia-driver-ubuntu-18-04 and linuxconfig.org/… I think I found the potential problem. (see edit)