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?

  • Try quoting your wildcard filenames in the purge, or using the explicit pacakge names. Anything blacklisting nvidia in /etc/modprobe.d/...? – ubfan1 Aug 24 '18 at 18:15
  • @ubfan1 It looks like something is blacklisting 'nvidiafb' could that be the culprit? Also thanks for the purge tip. Trying it now. – whenitrains Aug 24 '18 at 21:07
  • 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. – ubfan1 Aug 25 '18 at 0:01
  • I might have found the problem (see first edit). Still don't know the solution. – whenitrains Aug 25 '18 at 2:51
  • 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. – ubfan1 Aug 25 '18 at 3:31

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.

| improve this answer | |

Hmm, It might be hard, where if I got it right nvidia is supporting officially only 16.04 & 17.10 for CUDA. So it could need some efforts to get it working with 18.04, have you checked nvidia forums any guidance for it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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