304.135 fails to build/load on RHEL 7.4 kernel 3.10.0-693

I am trying to get a patch working for the legacy NVIDIA 304 series driver on the latest release of RedHat Enterprise Linux Server 7.4.
I have applied one of the patches I have found searching through this forum and was able to get it to build but now I am stuck trying to get it to load. Our Lab environment is a bit debilitating so I am still working on the getting the logs.

So the build error was fixed with the patch to nv-drm.c
line 74

  • .driver_features =0,
  • .driver_features = DRIVER_LEGACY,

The Load issue:
NVRM: request_mem_region failed for 16M @ 0x… This can
NVRM: occur when a driver such as rivatv is loaded and claims
NVRM: ownership of the device’s registers.

I have already blacklisted nouveau so I believe that driver isn’t causing me heartburn.
Does anyone have any troubleshooting tips or solutions for me?

I noticed a similar problem. Does it work the first time after a reboot?

These are a little rough, but should help.

If you have dkms installed for the video.

Besides the NV –uninstall
This is needed
dkms status
nvidia, 340.102, 3.10.0-693.el7.x86_64, x86_64: installed (WARNING! Diff between built and installed module!) (WARNING! Diff between built and installed module!

dkms remove -m nvidia/340.102 --all

I have a path forward for the 7.4 kernel breaking the NVidia driver. The one thing I have not tested yet is the Akmod NVidia driver, I am still waiting to see if NVidia issues a patch or updates their drivers.

August 2017
NVidia breakage fix/work-around.

  1. Ssh into the given system.
  2. systemctl isolate multiuser.target.
  3. systemctl set-default multiuser.target.
  4. Edit, /etc/grub/default.
  5. Remove rd.driver.blacklist=nouveau nouveau.modeset=0
  6. grub2-mkconfig -o /boot/grub2/grub.cfg
  7. cd /etc/modprobe.d/
  8. rm blacklist.conf
  9. mv /boot/initramfs-current-kernel.img /boot/initramfs-current-kernel-nouveau.img
  10. dracut /boot/initramfs-current-kernel.img initramfs-current-kernel, or dracut –f the quick route
  11. systemctl reboot
  12. locate nvidia.ko, if none sh ./NVidia … --uninstall, if nvidia.ko go to #16
  13. systemctl isolate graphical.target
  14. systemctl set-default graphical.target
  15. Reboot it should be good, if not reinstall xorg and mesa-GL.
  16. Try this sh ./NVIDIA-Linux-x86_64-###.###.run --no-opengl-files add a –z, if still some nouveau compliants.
  17. Locate nvidia.ko if gone start at #12 to #15, if still have nvidia.ko go #18.
  18. It is probably attached to an old kernel, uname –r < finds your current kernel, locate nvidia.ko will tell where it is located and what kernel it is attached to.
  19. Rpm –q kernel.
  20. Yum install yum-utils.
  21. Package-cleanup –oldkernels –count=2 < you may have to be specific, but it should not be on the current kernel.
  22. Locate nvidia.ko nope! If yes find me. Go to #12 to #15.
  23. Done I hope.
  24. Help link for Nouveau. https://nouveau.freedesktop.org/wiki/TroubleShooting/
  25. What if I need Nvidia !! Proceed at your risk “ NOT tested” look up akmod – nvidia

I played with it more yesterday and discovered that when the NVIDIA driver failed to install the memory resources were not getting freed. When I was able to reboot the machine without the driver trying to automatically install on reboot (via a service I put in place) I could get the patched driver to load.
Thank you.

the above is the correct solution for redhat 7.4 using the 3.10.0-693 kernel. To provide more detailed steps, I’ve found the following works for the 340.102 driver and 304.135 (use patch appropriate for version)

  1. make sure no nvidia.so file exists under /lib/modules/3.10.0-693.el7.x86_64 --if so, remove it
  2. boot system into multi user mode from grub to the update 693 kernel (add systemd.unit=multi-user.target to boot line)
  3. apply patch to nvidia installer; ./NVIDIA-Linux-x86_64-304.135.run --apply-patch legacy304.patch --add-this-kernel
  4. install driver using new custom installer ./NVIDIA-Linux-x86_64-304.135-custom.run

if using the 340 driver, obviously use the 340 installer and the 340 patch file

304 PATCH FILE
Save as legacy304.patch and put in same directory as nvidia installer

diff -crB kernel.orig/nv-drm.c kernel/nv-drm.c
*** kernel.orig/nv-drm.c	2017-08-14 11:07:48.824945102 +1000
--- kernel/nv-drm.c	2017-08-14 10:58:38.000000000 +1000
***************
*** 71,77 ****
  };
  
  static struct drm_driver nv_drm_driver = {
!     .driver_features = 0,
      .load = nv_drm_load,
      .unload = nv_drm_unload,
      .fops = &nv_drm_fops,
--- 71,77 ----
  };
  
  static struct drm_driver nv_drm_driver = {
!     .driver_features = DRIVER_LEGACY,
      .load = nv_drm_load,
      .unload = nv_drm_unload,
      .fops = &nv_drm_fops,

340 PATCH FILE
Save as legacy340.patch and put in same directory as nvidia installer

diff -crB kernel.orig/nv-drm.c kernel/nv-drm.c
*** kernel.orig/nv-drm.c	2017-01-17 06:15:32.000000000 +1000
--- kernel/nv-drm.c	2017-08-14 12:24:49.589986526 +1000
***************
*** 115,121 ****
  };
  
  static struct drm_driver nv_drm_driver = {
!     .driver_features = DRIVER_GEM | DRIVER_PRIME,
      .load = nv_drm_load,
      .unload = nv_drm_unload,
      .fops = &nv_drm_fops,
--- 115,121 ----
  };
  
  static struct drm_driver nv_drm_driver = {
!     .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
      .load = nv_drm_load,
      .unload = nv_drm_unload,
      .fops = &nv_drm_fops,

To remove nvidia.ko, do not just delete it or rename.

sh ./NVIDIA-Linux-x86_64-###.###.run --no-opengl-files add a –z if you have Nouveau bits that have not been blacklisted, < you have to specify no-opengl there are other files associated, so if it is still mentioned in /var/log/xorg.0.log you did not remove it correctly.

When it is no longer mention in the /var/log/xorg.0.log file you have successfully removed the nvidia.ko and associated files.

Thanks for you work r0b0