Leap 15.3: nVidia legacy drive 340.108 (patched) build error

From what I have understood, old nVidia legacy drivers (even patched for new kernels) are not supported anymore by Leap 15.3.
Is there any explanation for this?
I have tried to build 340.108 patched drivers (downloaded from https://nvidia.if-not-true-then-false.com/) and this is the result:

fatal error: linux/ioctl32.h: No such file or directory

340.108 builds perfectly on Leap 15.2.
I have noticed that my Leap 15.2 installation uses kernel 5.3.x-preempt, while Leap 15.3 uses kernel 5.3.x-default.

Kernel in Leap 15.2 is a backported kernel 5.6…
Kernel in Leap 15.3 is a backported Kernel 5.9…

So maybe!!! it will work if you patch more…
But I do not think so.

I have found this: https://www.if-not-true-then-false.com/2020/inttf-nvidia-patcher/
I can create a nVidia driver 340.108 patched for kernel 5.9/5.10/5.11/5.12, but the installation still fails with the same error.

I think, ask there.

I looked in the NVIDIA-Linux-x86_64-340.108 directory after running the magic inttf-nvidia-patcher.sh Script.

The Nvidia driver is build for a pure kernel 5.9 or 5.10 or so, but the Leap kernel is a kernel 5.3, backported from 5.9…

So f. e. this lines in NVIDIA-Linux-x86_64-340.108/kernel/nv-linux.h (line 137 ff)

#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
#include <linux/syscalls.h>         /* sys_ioctl()                      */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
#include <linux/ioctl32.h>          /* register_ioctl32_conversion()    */
#endif
#endif

is producing the error, because the installed kernel is a kernel 5.3…
But a backported 5.9…

So this line

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)

has to change to

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)

And maybe more lines in more files…

The strange thing is that these patches install and work perfectly on openSUSE Leap 15.2.
On Leap 15.3 is the module building that fails (ERROR: Unable to build the NVIDIA kernel module.)-

Leap 15.2 is a backported kernel 5.6 (with includes from kernel 5.6)
Leap 15.3 is a backported kernel 5.9 (with includes from kernel 5.9)

But both are name kernel 5.3

Its a openSUSE special…

At this point, the only solution is to give up!

Install 5.12 / 5.11 / 5.10 / 5.9 kernel, apply patch.
https://www.if-not-true-then-false.com/2021/debian-ubuntu-linux-mint-nvidia-guide/

Yes, but as I wrote above:
Leap kernel is 5.3…
So you have to patch more…

Also:
The 340 driver is not supported anymore, unsafe, maybe unstable …

Hi
Likewise that’s an Nvidia issue, I would suggest posting on their forums as likely to get a better response to a patch that will work.

And what can I do, if my 9800M GTX is supported by 340.108, but not with most recent legacy 390.144 driver according to nVIDIA?
Downgrade to 15.2 Leap and keep it until the laptop fails?
It should be possible to run it, right?
I just wonder why a 64-bit driver package asks for an ioctl32.h file… :\

Hi and welcome to the Forum :slight_smile:
Head over to the Nvidia forums, you should find some patches for the run file and use that for you older GPU, else just run nouveau.

Thanks for the hint. It is a bit frustrating, but I try.

I have nouveau installed now. It works for desktop ok, but performance sucks big time and it doesn’t seem to even work with Quake (1), hence 3D acceleration seems not to work properly. :frowning:
Well, I guess, if I want to play modern AAA games I stay with my Win10 PC instead anyway, but I hoped my old laptop would do for a few older games as well. Still, even Shapez runs more slowly, and Factorio is much slower and unplayable on nouveau.

I was wondering if the G04 (nVidia 309.144 driver could work with my 9800m GTX without frying it. I’m afraid to test it.

Hi
If you find the patches, it’s not too hard to add them to the run file?

If your 9800M GTX is soldered on a daughterboard then you can change it.

I found some patch in the previously mentioned file. I even managed to fix the kernel parameter in the nv-linux.h and build the patched version. Then it didn’t get the same error with ioctrl32.h anymore, but another one… Maybe wrong kernel or patch, but I am tired of working with console trying to edit some config files. Maybe openSuSE is a bit special case with their kernel versioning or whatever.

The patch script doesn’t work for me, so at least for now I decided to give up and use nouveau… sigh

I’m afraid it may even impact the entire mainboard of the laptop if the GFX adapter is accidentally overclocked or something similar. I understand too little about nVIDIA daughterboard, if it exists and how to replace on a Toshiba Qosmio… I would probably need to go to eBay or something to get a replacement, but that whole process would be too troublesome.

I had another try on this with the assumption that suse kernel is mostly version 5.9 but pretends to be 5.3.

So I changed all LINUX_VERSION_CODE defines between those versions to match that. And since I got compile errors I changed the defines back that caused them until the module compiled with those changes:

 diff -Nr -U0 NVIDIA-340xx/kernel-5.11.patch NV/NVIDIA-340xx/kernel-5.11.patch--- NVIDIA-340xx/kernel-5.11.patch	2021-10-04 11:55:09.000000000 +0200
+++ NV/NVIDIA-340xx/kernel-5.11.patch	2021-10-08 13:50:54.080722098 +0200
@@ -128 +128 @@
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
@@ -131 +131 @@
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 8, 0)
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 2, 0)
diff -Nr -U0 NVIDIA-340xx/kernel-5.9.patch NV/NVIDIA-340xx/kernel-5.9.patch
--- NVIDIA-340xx/kernel-5.9.patch	2020-11-23 00:45:00.000000000 +0100
+++ NV/NVIDIA-340xx/kernel-5.9.patch	2021-10-08 11:21:06.824529135 +0200
@@ -22 +22 @@
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
@@ -35 +35 @@
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
@@ -51 +51 @@
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
@@ -63 +63 @@
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
@@ -82 +82 @@
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
@@ -98 +98 @@
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)

The nvidia module builds, but hangs on loading, so I also give up here.

For now I use the still maintained 15.2 kernels while the rest of the system is 15.3. If that proves to be hard to maintain for me I probably switch to the latest vanilla kernel supported by the true/false-script or even the distro they support best.