For those who would like to immediately begin using Nvidia Driver 340.102 with Linux Kernel 4.12, apply the fully working patch provided here:
Name of the patch file is: “nv_patch_340.102_linux_kernel_4.12”, see direct links or extract from attached “patch.zip” file below
The patch is a cleaned-up combination of 4 individual patches for Linux Kernels 4.9, 4.10, 4.11 & 4.12
I have thoroughly tested the patch and it works well without any issues
100% FULL CREDIT and MANY THANKS for those original, individual patches go out to: Alberto Milone, Michael Marley, Robert Hooker & Piotr Oniszczuk
Instructions for Applying Patch [nv_patch_340.102_linux_kernel_4.12] to Nvidia Driver Compiler/Installer 340.102 used with Linux Kernel 4.12 in CLI/Terminal:
Download the following NVIDIA Driver Compiler/Installer file from NVIDIA website for Linux: NVIDIA-Linux-x86_64-340.102.run
Go into CLI/Terminal, and SU into root(#)
Completely Exit Xorg Server: The command “systemctl isolate multi-user.target” usually followed by “CTL+ALT+[F1 to F6]” will do this
In CLI, go into root then provide execution permissions: “chmod 755 NVIDIA-Linux-x86_64-340.102.run”
Copy [cp] Patch File “nv_patch_340.102_linux_kernel_4.12” into “NVIDIA-Linux-x86_64-340.102” directory
Go into [cd] “NVIDIA-Linux-x86_64-340.102” directory where patch file is now located
Apply Patch in that directory: “patch -p0 < nv_patch_340.102_linux_kernel_4.12”
Proceed with NVIDIA Driver Compilation & Installation by running “./nvidia-installer”. Important: Make sure the Nouveau Driver is disabled-blacklisted and modeset set to 0 in /etc/modprobe.d with “blacklist nouveau” & “options nouveau modeset=0”, and the Initial RAM Disk (initrd) is created prior to compiling, installing & rebooting. Enjoy!
Note 1: You may wish to test out the patch first by executing a Dry-Run with:
“patch --dry-run -p0 < nv_patch_340.102_linux_kernel_4.12”
Note 2: If you are getting a “gcc/cc-version-check failed” error, please run “./nvidia-installer --no-cc-version-check” after applying patch
Thanks for the patch. As a result I now have 340-102 running on Linux-4.12.8.
I have two PCI cards on my PC, the 8600GT and a TBS DVB-S2 card. Now that X11 works fine on 4.12.8, the other card, the TBS one does not, because I can’t compile the driver for the TBS card on Linux-4.12.8.
So I have to go back to Linux-4.9.44 where I can compile the TBS card driver.
But I found no patch yet to make the NVIDIA driver load on Linux-4.9.44. Yes I tried a number of patches, but either the driver won’t install or it won’t run.
So may I ask if by chance you have a patch that would make NVIDIA-340-102 load on Linux-4.9.44.
Hi ejmarkow. I installed the patch but the install failed. There is a problem with the number of arguments to NV_GET_USER_PAGES. I wish to attach the installer log but I can’t find how so I paste the last part of the log here.
In file included from /tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kern
el/os-mlock.c:15:0:
/tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel/nv-linux.h:2092:28:
note: expected 'int' but argument is of type 'struct page **'
static inline long NV_GET_USER_PAGES(unsigned long start,
^~~~~~~~~~~~~~~~~
/tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel/os-mlock.c:48:11: error: too few arguments to function 'NV_GET_USER_PAGES'
ret = NV_GET_USER_PAGES((unsigned long)address,
^~~~~~~~~~~~~~~~~
In file included from /tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel/os-mlock.c:15:0:
/tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel/nv-linux.h:2092:28: note: declared here
static inline long NV_GET_USER_PAGES(unsigned long start,
^~~~~~~~~~~~~~~~~
/tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel/os-mlock.c:28:23: warning: unused variable 'force' [-Wunused-variable]
NvBool write = 1, force = 0;
^~~~~
make[3]: *** [/ssd204/usr/src/linux-4.9.44/scripts/Makefile.build:294: /tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel/os-mlock.o] Error 1
make[2]: *** [/ssd204/usr/src/linux-4.9.44/Makefile:1493: _module_/tmp/selfgz1139/NVIDIA-Linux-x86_64-340.102-custom/kernel] Error 2
make[2]: Leaving directory '/usr/src/linux-4.9.44'
make[1]: *** [Makefile:150: sub-make] Error 2
make[1]: Leaving directory '/ssd204/usr/src/linux-4.9.44'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make: *** [Makefile:185: nvidia.ko] Error 1
-> Error.
ERROR: Unable to build the NVIDIA kernel module.
ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.
I found the issue, corrected it, and uploaded a new patch.zip file with nv_patch_340.102_linux_kernel_4.9 into my previous post (I removed the original one). Please download and apply it, I’m confident it will work with your Kernel 4.9 this time.
Don’t forget to apply it to a freshly extracted NVIDIA-Linux-x86_64-340.102.run file.
Thanks so much. The patch works like a charm. The driver is up and running.
You will surely be laughing now since that is the the simplest patch there could be. I am surprised that it works this time around since I am sure I have already tried that patch (I edited the file manually though) and the driver didn’t load then.
Technically it’s not working, at least in what I was attempting to fix. Cinnamon keeps crashing on log in, and only runs in fallback mode. I am currently just running in Gnome 3 with some tweaks, which is taking a bit of getting used to, but is better than Cinnamon fallback mode. :)
F25 reaches EOL next week, so I will just need to bite the bullet and upgrade soon anyway, which I am dreading but am assuming will fix the issue. Thank you for your help.