For those who would like to immediately begin using Nvidia Driver 340.104 with Linux Kernel 4.13 & Linux Kernel 4.14, apply the fully working patches provided here:
Name of the patch files are:
“nv_patch_340.104_linux_kernel_4.13”, see direct links or extract from attached “patch_4.13.zip” file below
“nv_patch_340.104_linux_kernel_4.14”, see direct links or extract from attached “patch_4.14.zip” file below
I have thoroughly tested both patches and they work well without any issues
Deserved Mentions & Thanks to: Alberto Milone, Michael Marley, & milhouse
Instructions for Applying Patches [nv_patch_340.104_linux_kernel_4.13] & [nv_patch_340.104_linux_kernel_4.14] to Nvidia Driver Compiler/Installer 340.104 used with Linux Kernels 4.13 & 4.14 in CLI/Terminal [2 Methods]:
Method 1:
Download the following NVIDIA Driver Compiler/Installer file from NVIDIA website for Linux: NVIDIA-Linux-x86_64-340.104.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.104.run”
Copy [cp] Patch File “nv_patch_340.104_linux_kernel_4.13” or “nv_patch_340.104_linux_kernel_4.14” into “NVIDIA-Linux-x86_64-340.104” directory
Go into [cd] “NVIDIA-Linux-x86_64-340.104” directory where patch file is now located
Apply Patch in that directory: “patch -p0 < nv_patch_340.104_linux_kernel_4.13” or “patch -p0 < nv_patch_340.104_linux_kernel_4.14”
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 AFTER compiling & installing the NVIDIA driver and PRIOR to 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.104_linux_kernel_4.13” or “patch --dry-run -p0 < nv_patch_340.104_linux_kernel_4.14”
Method 2:
Download the following NVIDIA Driver Compiler/Installer file from NVIDIA website for Linux: NVIDIA-Linux-x86_64-340.104.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.104.run”
./NVIDIA-Linux-x86_64-340.104.run --apply-patch nv_patch_340.104_linux_kernel_4.13
or
./NVIDIA-Linux-x86_64-340.104.run --apply-patch nv_patch_340.104_linux_kernel_4.14
Note: This applies the patch ‘Patch’ to the kernel interface files included in the .run file, remove any precompiled kernel interfaces and then repackage the .run file. The new .run file will be placed in the current directory and the string “-custom” appended to its name, unless already present, to distinguish it from the original .run file.
Proceed with NVIDIA Driver Compilation & Installation by running the new patched “./NVIDIA-Linux-x86_64-340.104.run” -custom file. 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 AFTER compiling & installing the NVIDIA driver and PRIOR to rebooting. Enjoy!
Note 2: If you are getting a “gcc/cc-version-check failed” error, please run “./nvidia-installer --no-cc-version-check” after applying patch
Google link for patch “nv_patch_340.104_linux_kernel_4.13” on Pastebin: https://goo.gl/9MSsCL
Google link for patch “nv_patch_340.104_linux_kernel_4.14” on Pastebin: https://goo.gl/eVTUkj
Both patches I provided, for Linux Kernels 4.13 & 4.14, work perfectly well, have been thoroughly tested, for 32-bit & 64-bit, and successfully build two designated modules: nvidia & nvidia_uvm.
Please check your procedures again, make sure you have Nouveau blacklisted, and that you rebuild your initrd [boot loader initialized RAM disk] after you compile the Nvidia Kernel drivers with patch applied but before you reboot using your new Nvidia video drivers.
update-grub
Generating grub configuration file …
Found linux image: /boot/vmlinuz-4.14.0-041400-generic
Found initrd image: /boot/initrd.img-4.14.0-041400-generic
Found linux image: /boot/bzImage-4.9.58-xxxx-std-ipv6-64
No volume groups found
Please read carefully Method 1 (Step 9) and / or Method 2 (Step 6).
Anyway, in the end, did the Nvidia Driver 340.104 compile for you on Linux Kernel 4.14.0-041400, building the modules nvidia & nvidia_uvm? Does it all work now?
The new driver is released 340.106. Release Date: 2018.1.16. Is this driver patched? Somebody knows? From page, Release highlights: Fixed a compatibility problem between the nvidia.ko’s Page Attribute Table (PAT) support and the kernel Page Table Isolation (PTI) patches.