Latest NVIDIA Driver 340.101 Builds / Compiles Properly, but Fails to Load (has errors) with Linux Kernels 4.9.0 - 4.9.7 [RESOLVED with PATCH]

See following post: https://devtalk.nvidia.com/default/topic/981852/linux/resolution-patch-attached-for-nvidia-linux-driver-340-98-x86_64-using-linux-kernel-4-9/post/5038307/#5038307

What does work well is NVIDIA Driver 340.98 with PATCH applied, mentioned in that post.

Also see log excerpt & attachment in that post.

Same problem with LibreELEC (embedded Kodi) with 340.101, Linux 4.9.0, Xorg 1.19 and ION/ION2 hardware.

dmesg: http://sprunge.us/WQbY
journalctl: http://sprunge.us/QMNi
/var/log/Xorg.0.log: http://sprunge.us/AYAK

The 340.101 driver is working well with Linux 4.8.13, but the 340.xx driver has always had this “already registered” problem with 4.9 since at least 4.9-rc2 - I had hoped (expected?) 340.101 would fix this issue.

Apply the following PATCH to NVIDIA Driver 340.101 for it to work with Linux Kernel 4.9. It adds 4 lines of code to the nv-drm.c file to enable the “DRIVER_LEGACY” flag if kernel version is >= 4.9.0.

PATCH / Filename: patch_nv1 http://pastebin.com/raw/mSwYvy1L

Basic Procedure for Applying PATCH to NVIDIA Driver:

  1. Download the following NVIDIA binary/driver file from NVIDIA website for Linux: NVIDIA-Linux-x86_64-340.101.run
  2. Go into CLI/Terminal
  3. Provide execution permissions: chmod 755 NVIDIA-Linux-x86_64-340.101.run
  4. Extract: ./NVIDIA-Linux-x86_64-340.101.run --extract-only
  5. Copy Patch File “patch_nv1” into “NVIDIA-Linux-x86_64-340.101” directory
  6. Go into (cd into) “NVIDIA-Linux-x86_64-340.101” directory where patch file is now located
  7. Apply Patch: patch -p0 < patch_nv1
  8. Proceed with NVIDIA Driver Installation, Enjoy!

Tested on my Linux system & runs very well, both nvidia.ko & nvidia_uvm.ko compile and load without any issues.

patch_nv1.zip (417 Bytes)

Many thanks @ejmarkow! Your patch works perfectly. I’ve added it to LibreELEC here.

You can apply the patch directly to the .run file

./NVIDIA-Linux-x86_64-340.101.run --apply-patch patch_nv1

I just want to let people know that I used ejmarkow’s patch and successfully got nvidia 340.101 to work on my system running openSUSE Leap-42.2 with the 4.9.0 Linux Kernel.

See the last post in this thread for more information:
https://devtalk.nvidia.com/default/topic/982666/linux/help-me-install-nvidia-340-101-drivers-on-a-macbook-1342-running-fedora-25-without-blank-screen/post/5040532/?offset=10#5042520

should we be looking for a driver update soon?

Hi

For me the patch worked right but only after changing the login session manager. I was using gdm and now I changed it to kdm. At least this the only thing I was finally did and then it worked.
I’m using Fedora 25 with kernel 4.9.3-200, nvidia legacy 340.101 patched, and xorg is 1.19.1.

Thank you very much for the patch.

Cheers.

Apply the following PATCH to NVIDIA Driver 340.101 for it to work with Linux Kernel 4.9. It adds 4 lines of code to the nv-drm.c file to enable the “DRIVER_LEGACY” flag if kernel version is >= 4.9.0.

PATCH / Filename: patch_nv1 http://pastebin.com/raw/mSwYvy1L

Basic Procedure for Applying PATCH to NVIDIA Driver:

  1. Download the following NVIDIA binary/driver file from NVIDIA website for Linux: NVIDIA-Linux-x86_64-340.101.run
  2. Go into CLI/Terminal
  3. Provide execution permissions: chmod 755 NVIDIA-Linux-x86_64-340.101.run
  4. Extract: ./chmod 755 NVIDIA-Linux-x86_64-340.101.run --extract-only
  5. Copy Patch File “patch_nv1” into “NVIDIA-Linux-x86_64-340.101” directory
  6. Go into (cd into) “NVIDIA-Linux-x86_64-340.101” directory where patch file is now located
  7. Apply Patch: patch -p0 < patch_nv1
  8. Proceed with NVIDIA Driver Installation, Enjoy!

Tested on my Linux system & runs very well, both nvidia.ko & nvidia_uvm.ko compile and load without any issues.

Hi… quick question from a new poster. I’ve been having nothing but problems with my FC25 Linux box after the FC25 upgrade, related to the nvidia driver. I’m using a legacy GeForce 8400 GS video card. I understand the instructions above for applying the patch to the uncompressed 340.101 archive. What are the specifics for 8) above? Should I expect an issue since I’ve already run the installer a few times, without success?

Thanks for any help you all can provide…

BillR_FCUser …

After you apply the patch, remain in the same directory [NVIDIA-Linux-x86_64-340.101] and run the unpacked installer with the command:

./nvidia-installer

Do NOT run the original installer using ./NVIDIA-Linux-x86_64-340.101.run because this does not contain the patched file(s).

Thanks so much for the reply. I tried this and got the (now usual) error:

ERROR : Unable to load the kernel module ‘nvidia.ko’. This happens most
frequently when this kernel module was built against the wrong or
improperly configured kernel sources, with a version of gcc that…

I’m running the following kernel (from uname -a):
Linux flash 4.9.3-200.fc25.x86_64 #1 SMP Fri Jan 13 01:01:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linix

Trying nvidia driver install on a Dell Poweredge T310 with 32GB memory and Intel X3470 quad processor. I’m thinking my
problem has to do with the fact I’m using a Dell server… BIOS settings perhaps? I had a similar problem when I upgraded to FC23,
but don’t remember how I got it working. I don’t know what video cards are supported by the platform. Maybe I need to spring for a legacy AMD Catalyst card…

Thanks for your help.

Information Update (Nvidia Driver 340.101, Linux Kernels, Patches):

The provided patch works successfully with Nvidia driver 340.101 and Linux Kernel 4.9.7, just tested.

Hence, the patch with driver 340.101 works well for Linux Kernels ranging from 4.9.0 - 4.9.7.

As of yet, no patch is available for this driver with Linux Kernel 4.10-rc6. The patch provided here doesn’t work with that kernel.

Hopefully, one will be available soon.

I’m building 4.10-rc6 with both 375.26 and 340.101 using the nvidia driver commits on this pull request.

375.26 patch
340.101 patch

Both commits are disabling hotplug support, but that’s enough for a fully working kernel and driver at this stage.

Edit: 340.101 also needs this patch in order to successfully load on 4.9+ kernels.

Updated 4.10-rc8 patches for 375.39 and 340.102

375.39
340.102 + fix for 4.9+

As before, both patches disable CPU hotplug support.

Resume-from-suspend is confirmed as fixed with 375.39.

Hi BillR,
Similar to yourself, I’m on a Dell T3500 workstation and none of the patches for .101/.102 or .98 have worked for my F24 install. I’m still getting NVRM: failed to register procfs! as well as the main message unable to load the kernel module nvidia.ko.

The odd thing is, if I rollback to use a 4.8 kernel from my F23 installation, the NVidia install using any one of the patched driver versions above work.

Were you able to solve this issue?
sodo

When you were trying to get it to work with gdm, were you having issues with Wayland? is that why you switched to kdm?

error :

./NVIDIA-Linux-x86_64-340.102.run --apply-patch 4.10.0_kernel.patch 
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 340.102.................................................................................................................................................................................................................................
can't find file to patch at input line 16
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 983a2ca221a371e08bb5ad11758a729cfa5aa88c Mon Sep 17 00:00:00 2001
|From: Alberto Milone <alberto.milone@canonical.com>
|Date: Wed, 15 Feb 2017 17:05:55 +0100                                       
|Subject: [PATCH 1/1] Add support for Linux 4.10                             
|                                                                            
|---                                                                         
| nv-linux.h            |  7 +++++++                                         
| nv-pat.c              | 40 ++++++++++++++++++++++++++++++++++++++++        
| uvm/nvidia_uvm_lite.c |  4 ++++                                            
| 3 files changed, 51 insertions(+)                                          
|
|diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
|index e7068e3..2d62492 100644
|--- a/kernel/nv-linux.h
|+++ b/kernel/nv-linux.h
--------------------------
File to patch:

Try this:

sed ‘s|./kernel|kernel|g’ kernel_4.10.patch > kernel_4.10.patch.conformant
sh ./NVIDIA-Linux-x86_64-378.13.run --apply-patch kernel_4.10.patch.conformant

Thanks so much for making this patch. I’m so glad I finally got this working on my ancient Macbook 2,1

It works awesomely :D