DKMS issues with NVidia drivers in kernels > 4.3

I have a Dell Inspiron 7559 with an Nvidia GTX960M, running 14.04, currently on kernel 4.3. I wanted to upgrade my kernel for better Skylake support, but I have been unable to find an Nvidia driver+kernel combination that works: I tried 4.4 main, 4.5, 4.6 rc1 and rc2, with varying choices between 358, 361 and 364 (both from the website as well as graphics-drivers PPA), and I always keep getting the message “unable to build for kernel xxx” or some “DKMS apport: error building for kernel xxx”.

Can anyone shed some light on how to pick the best drivers (also is graphics-drivers the best PPA choice?), and if there are some patches required?

You probably will need to post the full error and attach the relevant logs. There’s no reason you should not be able to build 364 for newer kernels. I’m running the 364.19 drivers from the graphics-drivers PPA on Ubuntu 16.10 (kernel 4.4.0-23-generic) without issue.

The initial error:

Building for architecture x86_64
Building initial module for 4.5.7-040507-generic
ERROR (dkms apport): kernel package linux-headers-4.5.7-040507-generic is not supported
Error! Bad return status for module build on kernel: 4.5.7-040507-generic (x86_64)
Consult /var/lib/dkms/nvidia-361/361.45.11/build/make.log for more information.

Relevant details from inside the log:

CC [M]  /var/lib/dkms/nvidia-361/361.45.11/build/nvidia/nv-frontend.o
  CC [M]  /var/lib/dkms/nvidia-361/361.45.11/build/nvidia/nv-instance.o
cc: error: unrecognized command line option ‘-fstack-protector-strong’
make[2]: *** [/var/lib/dkms/nvidia-361/361.45.11/build/nvidia/nv-frontend.o] Error 1
make[2]: *** Waiting for unfinished jobs....
cc: error: unrecognized command line option ‘-fstack-protector-strong’
make[2]: *** [/var/lib/dkms/nvidia-361/361.45.11/build/nvidia/nv-instance.o] Error 1
make[1]: *** [_module_/var/lib/dkms/nvidia-361/361.45.11/build] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-4.5.7-040507-generic'
make: *** [modules] Error 2

The exact same situation repeats in all kernels I’ve tried, with all driver versions such as 358, 361, 364 etc.

Ah, the problem is your gcc version. I ran into that myself a while back.

Install gcc-4.9 and change the symlink (/usr/bin/gcc) to point to it instead of gcc-5 and it will work.

apt install gcc-4.9
sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.9 gcc

Later down the road, if they get gcc-5 to handle the -fstack-protector-strong flag, or nvidia updates their driver, you can restore things to their original state:

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-5 gcc

Thank you very much! That was it. After I pointed gcc to 4.9, I was able to compile 364.19 for kernel 4.6.

You’re welcome! Glad I could help.

hi guys,

I recently got a DELL 7559 Core i7 with Nvidia gtx 960m.

I have trouble in getting the GPU work with Ubuntu 14.04 and I end up in different issues

  1. blackscreen
  2. login loops.

could you please share how you got your GPU driver installed