Trouble installing Nvidia drivers on kernels >4.3

I have a Dell Inspiron 7559 with an Nvidia GTX960M. After a lot of trial and error when I first got the laptop, I installed 14.04 with kernel 4.3.0 with the nvidia-352 driver from graphics-drivers PPA (I had to move away from the default kernel because there were extremely bad issues with my Skylake CPU being locked to 800 MHz and such). But later on, I figured out that kernel 4.3 still has some issues with my laptop, so I’ve been looking to move to newer kernels. 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, and I always keep getting the message “unable to build for kernel xxx”, and when I reboot, I’m stuck with the Intel driver. 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?

That’s your default gcc. You need to install gcc 5.3 or higher, and relink your default /usr/bin/gcc to the 5.3 version you installed. Also, you should be using the 4.5.5 kernel. 4.3 isn’t mature on the skylake side of things. 4.4 is the minimum.

This is what my gcc looks like relinked to 5.3.

/usr/bin $ ls -al gcc*
lrwxrwxrwx 1 root root 5 Feb 6 00:32 gcc -> gcc-5
-rwxr-xr-x 1 root root 775888 Nov 30 22:25 gcc-4.8
-rwxr-xr-x 1 root root 878384 Dec 5 18:01 gcc-5
lrwxrwxrwx 1 root root 8 Feb 6 00:33 gcc-ar -> gcc-ar-5
-rwxr-xr-x 1 root root 26968 Nov 30 22:25 gcc-ar-4.8
-rwxr-xr-x 1 root root 26976 Dec 5 18:01 gcc-ar-5
lrwxrwxrwx 1 root root 8 Feb 6 00:33 gcc-nm- -> gcc-nm-5
-rwxr-xr-x 1 root root 26968 Nov 30 22:25 gcc-nm-4.8
-rwxr-xr-x 1 root root 26976 Dec 5 18:01 gcc-nm-5
lrwxrwxrwx 1 root root 12 Feb 6 00:34 gcc-ranlib -> gcc-ranlib-5
-rwxr-xr-x 1 root root 26968 Nov 30 22:25 gcc-ranlib-4.8
-rwxr-xr-x 1 root root 26976 Dec 5 18:01 gcc-ranlib-5

As for the driver… you’re on ubuntu… so your doing phoronix’s drivers?
So… let’s see. It’s:

add-apt-repository ppa:graphics-drivers/ppa
apt-get update
apt-get install nvidia-361 bumblebee

You seem to be on Optimus/Intel-Nvidia hybrid thingy, which required bumblebee to work.

So in short, this isn’t a kernel problem(if you update it). It’s a compiler problem and lack of bumblebee to handle the intel/nvidia switching. That’s it. No worries buddy. You aren’t the first person to get boned because Nvidia refuses to support their own hardware. Good luck.

Thanks for the reply! So I first installed gcc-5.3 and g+±5.3, and linked them and made sure that gcc --version returns 5.3. Then I installed kernel 4.5.4 first and then tried nvidia-361, but still I get the message along the lines of:

dkms: bad return status, cannot build for linux-image-4.5.5-040505-generic

Could I be missing a step somewhere?

Hmm… that’s not a compiler problem at least. Sounds like you don’t have the build tools.

If you are on ubuntu/debian/whatever, you needa do something like this:

apt-get install dkms build-essential make linux-headers-generic

That will allow you to build a dkms module.

You have the right kernel. Your intel drivers are up to date. Skylake is up to date. You have the right gcc. It should work if you have the build tools for compiling a kernel module. I would try installing the conservative nvidia-352 driver first. And then upping it to 361 if that passes muster.