NVIDIA Driver installation error

Unable to install NVIDIA Drivers via Runfile installation.

System specs:
Laptop: HP Pavillion 15
Processor: i7-7500U, 8GB RAM
OS: Ubuntu 16.04.3 LTS
Kernel: 4.10.0-32
GPU: GM108M [GeForce 940MX]

Logfile link:

Long Version:
I installed NVIDIA Driver 375.26 on Ubuntu 16.04 about a month back on a new laptop (installed Ubuntu just a few hours before the nVIDIA drivers). Without OpenGL libraries. I successfully installed it and ran deviceQuery as well as installed cudNN and ran the Tensorflow MNIST script on the GPU.

However a couple days back my code stopped working and nvidia-smi generated no output. I tried reinstalling the drivers but was constantly met with a kernel source not found error. After spending the last two days unable to debug the error, I decided to reinstall my Ubuntu itself (since it worked just a month back) However I get the same error even on a fresh Ubuntu install. I dug through the log file an the specific error was: “error: too few arguments to function ‘get_user_pages_remote’”. So I figured it might be a kernel update in the last one month that caused the issue and sure enough, my live USB stick has 4.08 whereas the fresh install after updating has 4.10.

So finally my question is, is this the source of the error for being unable to install the NVIDIA drivers? And if yes, how do I fix it?

The reason I want a runfile installation is because I don’t want the display to be rendered from the NVIDIA card. Is there a better way to allow my card to be left idle exclusively for deep learning?

Yes, a kernel update will break your runfile install.

And if your kernel update only included the kernel update, and not the kernel sources, then you’re not going to be able to install or rebuild the driver against the new kernel.

Thanks for the response txbob!

I tried installing all corresponding kernel files that I could think of i.e. linux-image/linux-source/linux-headers

Is there something I’m missing? Or alternative kernel update procedure that takes care of this as well?