32

I am trying to install nvidia drivers on my ubuntu 16.04 (I have a GeForce GTX 960M). I tried a lot of methods explained on internet but none seems to work. (I saw How to install nvidia-smi?, nvidia-smi: command not found on Ubuntu 16, but these did not help...)

Indeed when I run nvidia-smi, I get nvidia-smi command not found, and when I run lshw -numeric -C display I see that my graphical card is has status display unclaimed. I don't know if it is related but it seems weird

1

12 Answers 12

22

The solution that worked for me was to disable secure boot when rebooting after installing the NVIDIA drivers.

sudo apt purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-381

Then reboot, in the menu choose "change secure boot options", put the password you previously chose and disable the secure boot.

7
  • 1
    I have disabled boot secure, but still it does not work. I changed to 384 (with Cuda 8.0), still does not work.
    – khan
    Apr 9, 2018 at 16:23
  • 1
    This did not work for me
    – Hakaishin
    Oct 11, 2018 at 8:08
  • Not work for me. I got Package nvidia-381 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'nvidia-381' has no installation candidate
    – Bowen Xu
    Dec 12, 2019 at 3:10
  • 7
    How to find which version to install? I mean nvidia-381 or nvidia-340.... Jul 28, 2020 at 17:28
  • Thanks for secure boot disabling feature. I just have disabled it in BIOS and nvidia driver started working, because I already installed it while system installing. Ubuntu 20.04.
    – James Bond
    Nov 2, 2020 at 9:27
6

Try updating the driver.

  1. Add the PPA by running the following commands in terminal:

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt-get update
    
  2. Open Software & Updates from System Settings or directly from Dash, click on the Additional Drivers tab, select the driver you want to use, and click Apply changes.

  3. After the driver is downloaded and installed, restart your system.

4
  • 1
    it did not help...
    – fonfonx
    Apr 8, 2017 at 20:41
  • It does not work. Despite selection of NVIDIA driver, it reverts it and select xorg...
    – khan
    Apr 9, 2018 at 16:24
  • 2
    +1 I would usually use the cli, but this was better than the answer above. Got me working without having to worry about purging packages or which version to install - I got a more updated one without having to try... Nice!
    – Free Url
    Dec 13, 2019 at 23:12
  • Glad it worked for you @FreeUrl Dec 12, 2020 at 10:37
1

In my case, just disabling secure boot in the BIOS solved the problem.

1

The driver's version depends on your GPU. Check it here, before installing any driver: https://www.nvidia.com/Download/index.aspx?lang=en-us

1

I've had this condition, this happens if you somehow boot the all-working system w/o an NVidia card and then NVidia drivers and utils disappear.

This is what helped: (considering your CUDA version is 9.2 and driver version is 418)

sudo vi /etc/ld.so.conf.d/cuda-9-2.conf 

/usr/local/cuda-9.0/targets/x86_64-linux/lib 
/usr/lib/nvidia-418   ( <<- add this line)

Then do:

sudo dpkg-reconfigure nvidia-418

Then reboot. It should work.

So, in case, it still does not, just reinstall Cuda completely, that will do it.

0

You should use nvidia-current when you run install, so you can get the latest release.

3
  • 5
    nvidia-current in Ubuntu 16.04 is Version: 304.135-0ubuntu0.16.04.1 which is not the latest release.
    – karel
    Dec 30, 2017 at 22:25
  • You're right. Looks like nvidia's current is not really current! So find the latest release on nvidia's web site and use the specific version (nvidia-<version>). Thanks!
    – ibrahim
    Dec 30, 2017 at 22:32
  • +1: This answer might be invalid now, but may be helpful in the future
    – ntg
    Dec 27, 2018 at 23:19
0

This worked for me:

sudo apt purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-driver-396

Some use aptitude instead of apt:

sudo apt purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install aptitude
sudo aptitude install nvidia-driver-396

If nothing works, please check your ubuntu (if that's your case) kernel as several guides state that some kernels are not supported by Nvidia. Ukuu is a simple tool to install different kernels and add them to GRUB. I changed mine (in ubuntu-18.04 LTS) to 4.18.4-041804-generic and find it pretty good and stable.

If this code doesn't work follow this tutorial until step 8. Though the main objective is the complete installation with also CUDA, cuDNN, NCCL, tensorflow, etc I found it good to install Nvidia drivers also (learnt the kernel issue from it, in the comments)

0

Only thing that worked for me was I had to uninstall everything related to nvidia and bumblebee, and upgrade my kernel from 4.4 to 4.8.17 with the help of the Ukuu package, and install 390 version of the drivers.

0

I had faced the same issue. All the answers will correctly let you solve the problem.

Problem: But the main issue is with driver version. You would have enabled latest version like 430 or such. But idk why but later versions cause this error. Even if you disable secure boot, it'll say "Ubuntu is working on low graphics"

Solution: Install the version lower than 400 say 381, or whatever your case be. Just search in additional drivers under Ubuntu software settings.

0

If none of these won't work, you might have secure boot activated, for example if you dual boot. Either turn it off, but if you cannot like me, this post made me able to get drivers working WITH secure boot: How to install nvidia driver with secure boot enabled?

0
  1. Disable secure boot.

  2. Purge all existing Nvidia drivers. Take Trying to Install Nvidia packages, unable to correct problems you have held broken packages as a reference.

  3. Check which drivers are suggested with

ubuntu-drivers devices

and then install them:

sudo ubuntu-drivers autoinstall

See How do I know which NVIDIA driver I need? or https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux for more info.

3.(Optional) Install Cuda. Follow https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation. Make sure to install cuda version compatible with your drivers.

  1. Install the cuda toolkit:

sudo apt install nvidia-cuda-toolkit

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

and reboot with "sudo reboot".

5.

sudo prime-select nvidia

and reboot with "sudo reboot".

6.

nvidia-smi

  1. Profit
0

I will give a bit more troubleshooting instructions.

First, ensure you have "Secure boot" in your BIOS->Security menu set to Disabled.

Then, from the accepted answer:

sudo apt purge "*nvidia*"
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update -y
sudo apt-get install aptitude
sudo aptitude install -y nvidia-driver-XXX

where XXX stands for the driver version you can find on this webpage: https://www.nvidia.com/Download/index.aspx?lang=en-us.

At this moment, you could try the following:

sudo modprobe nvidia

If this command produces no output, you can reboot first or straightaway check your installation with the following:

nvidia-smi

If the modprobe command fails, welcome to the jungle. If it is something like:

modprobe: ERROR: could not insert 'nvidia': Key was rejected by service

The issue is "Secure boot" is set to Enabled. Otherwise, copy your problem in Google and browse official Nvidia forums for support.

Keep in mind:

  • installing a driver from the official Nvidia download webpage is not recommended. Your distribution should know which driver version it should use by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .