Ubuntu – Ubuntu 16.04: NVIDIA drivers don’t work for GTX 960M

16.04driversgraphicsnvidianvidia-geforce

UPDATE:
It worked for a while with 375, I think. Then, it suddenly stopped working today. I've tried purging and reinstalling both 384 and 375, but had no luck. They still give me black screens, and nvidia-detector still gives me none.

I've been using CUDA for a while, but I didn't pay too much attention to whether my graphics are rendered by my NVIDIA card.

UPDATE:
I just found out that nvidia-367 was not correctly installed. When I reinstalled it, I begin getting the same problem I've always got: no desktop at all. So, I purged all nvidia drivers (sudo apt purge nvidia-*) and things were good again.

I thought that it might be the driver is too new, so I tried nvidia-340 from the graphic drivers PPA. This time the desktop did show up, but after I opened nvidia-settings and set the system to use my NVIDIA graphics card, I get a login loop after I logged out. I troubleshooted my problem according to the instructions given here, but nothing worked. Any driver newer than nvidia-340 gives me a blank screen.

I've checked my boot (UEFI) settings and I did disable secure boot, so that should not be causing any problems. I've done another glxinfo after I uninstalled all NVIDIA drivers, and it's right here: it looks like Nouveau doesn't even recognize my video card.

I do need to use my NVIDIA card because I do machine learning stuff and need to use CUDA, so I dp need some NVIDIA driver to be installed. My laptop model is Dell Inspiron i7559 and my Linux kernel version is 4.4.0-31-generic, if these matter.


I have installed the nvidia-367 driver successfully, and my desktop does show up (after trying quite a few drivers). However, when I type nvidia-detector into my terminal, none is returned. lspci does correctly lists my graphic card. My NVIDIA graphics card is GeForce GTX 960M.

Update:
I've tried a few drivers, namely nvidia-361, 364 and 370. None of them worked – the best outcome I've got is a login loop (which I could not fix even after searching online), and usually it's a black screen showing up (again, the solutions online and on here just don't work).
glxinfo gives this output: http://paste.ubuntu.com/23316740/, although I personally have no idea what this output means.
And here is what lspci says:
00:02.0 VGA compatible controller: Intel Corporation Skylake Integrated Graphics (rev 06)' and
02:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2).

Best Answer

I was facing same problem. I use the same GPU. Skylake and gtx960m

Here is how i fixed it.

  1. Disable the secure boot and reboot

  2. update the gl alternatives: run

    sudo update-alternatives --config x86_64-linux-gnu_gl_conf
    

    choose the nvidia drivers you have. this is what it looks for me:

    There are 3 choices for the alternative x86_64-linux-gnu_gl_conf (providing /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf).
    
    Selection    Path                                       Priority   Status
    ------------------------------------------------------------
    * 0            /usr/lib/nvidia-375/ld.so.conf              8604      auto mode
      1            /usr/lib/nvidia-375-prime/ld.so.conf        8603      manual mode
      2            /usr/lib/nvidia-375/ld.so.conf              8604      manual mode
      3            /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf   500       manual mode
    

    Now your nvidia device files should be created in /dev.

  3. In case you are stuck in login-loop, just purge and install nvidia drivers again and login by logging into tty1

    sudo apt-get --purge remove nvidia-*
    apt-cache search nvidia 
    

    (you will find some versions of drivers - choose one to test install)

    sudo service lightdm stop
    sudo apt-get install nvidia-375 (for example)
    sudo service lightdm start
    

Everything works.