Solved Nvidia drivers don't build with debian kernel 6.12.88+

Solved issue

CaffeineAddict

Well-Known Member
Joined
Jan 21, 2024
Messages
3,968
Reaction score
4,156
Credits
32,446
Bash:
dpkg -l | grep linux-image
ic  linux-image-6.12.69+deb13-amd64                     6.12.69-1                             amd64        Linux 6.12 for 64-bit PCs (signed)
ic  linux-image-6.12.73+deb13-amd64                     6.12.73-1                             amd64        Linux 6.12 for 64-bit PCs (signed)
ic  linux-image-6.12.74+deb13+1-amd64                   6.12.74-2                             amd64        Linux 6.12 for 64-bit PCs (signed)
ic  linux-image-6.12.85+deb13-amd64                     6.12.85-1                             amd64        Linux 6.12 for 64-bit PCs (signed)
ii  linux-image-6.12.86+deb13-amd64                     6.12.86-1                             amd64        Linux 6.12 for 64-bit PCs (signed)
ic  linux-image-6.12.88+deb13-amd64                     6.12.88-1                             amd64        Linux 6.12 for 64-bit PCs (signed)
ii  linux-image-7.0.4+deb13-amd64                       7.0.4-1~bpo13+1                       amd64        Linux 7.0.4 for 64-bit PCs
ii  linux-image-amd64

This are the kernels, nvidia.run driver doesn't build on kernels 6.12.88 (stable repo) and 7.0.4 (backports)

I've tried all 3 of them, production, new feature and beta drivers all fail to build on most recent kernels available.
dkms or manual it doesn't matter, build fails with the following build error from /var/log/nvidia-installer.log:

BTF [M] nvidia-modeset.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia-modeset.ko] Error 1
make[4]: *** Deleting file 'nvidia-modeset.ko'
LD [M] nvidia.ko
LD [M] nvidia-uvm.ko
BTF [M] nvidia.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia.ko] Error 1
make[4]: *** Deleting file 'nvidia.ko'
LD [M] nvidia-drm.ko
LD [M] nvidia-peermem.ko
BTF [M] nvidia-peermem.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
BTF [M] nvidia-drm.ko
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia-peermem.ko] Error 1
make[4]: *** Deleting file 'nvidia-peermem.ko'
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia-drm.ko] Error 1
make[4]: *** Deleting file 'nvidia-drm.ko'
BTF [M] nvidia-uvm.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia-uvm.ko] Error 1
make[4]: *** Deleting file 'nvidia-uvm.ko'
make[4]: Target '__modfinal' not remade because of errors.
make[3]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:2061: modules] Error 2
make[2]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:260: __sub-make] Error 2
make[2]: Target 'modules' not remade because of errors.
make[2]: Leaving directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
make[1]: *** [Makefile:260: __sub-make] Error 2
make[1]: Target 'modules' not remade because of errors.
make[1]: Leaving directory '/usr/src/linux-headers-7.0.4+deb13-common'
make: *** [Makefile:138: modules] Error 2
-> Checking to see whether the nvidia kernel module was successfully built
executing: 'cd kernel-open; /usr/bin/make -k -j4 NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/7.0.4+deb13-amd64/source" SYSOUT="/lib/modules/7.0.4+deb13-amd64/build" NV_KERNEL_MODULES="nvidia"'...
make[1]: Entering directory '/usr/src/linux-headers-7.0.4+deb13-common'
make[2]: Entering directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
MODPOST Module.symvers
WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia.o
LD [M] nvidia.ko
BTF [M] nvidia.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia.ko] Error 1
make[4]: *** Deleting file 'nvidia.ko'
make[4]: Target '__modfinal' not remade because of errors.
make[3]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:2061: modules] Error 2
make[2]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:260: __sub-make] Error 2
make[2]: Target 'modules' not remade because of errors.
make[2]: Leaving directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
make[1]: *** [Makefile:260: __sub-make] Error 2

make[1]: Target 'modules' not remade because of errors.
make[1]: Leaving directory '/usr/src/linux-headers-7.0.4+deb13-common'
make: *** [Makefile:138: modules] Error 2
-> Checking to see whether the nvidia kernel module was successfully built
executing: 'cd kernel-open; /usr/bin/make -k -j4 NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/7.0.4+deb13-amd64/source" SYSOUT="/lib/modules/7.0.4+deb13-amd64/build" NV_KERNEL_MODULES="nvidia"'...
make[1]: Entering directory '/usr/src/linux-headers-7.0.4+deb13-common'
make[2]: Entering directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
MODPOST Module.symvers
WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia.o
LD [M] nvidia.ko
BTF [M] nvidia.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia.ko] Error 1
make[4]: *** Deleting file 'nvidia.ko'
make[4]: Target '__modfinal' not remade because of errors.
make[3]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:2061: modules] Error 2
make[2]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:260: __sub-make] Error 2
make[2]: Target 'modules' not remade because of errors.
make[2]: Leaving directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
make[1]: *** [Makefile:260: __sub-make] Error 2
make[1]: Target 'modules' not remade because of errors.
make[1]: Leaving directory '/usr/src/linux-headers-7.0.4+deb13-common'
make: *** [Makefile:138: modules] Error 2
-> Error.
ERROR: An error occurred while performing the step: "Checking to see whether the nvidia kernel module was successfully built". See /var/log/nvidia-installer.log for details.
-> The command cd kernel-open; /usr/bin/make -k -j4 NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/7.0.4+deb13-amd64/source" SYSOUT="/lib/modules/7.0.4+deb13-amd64/build" NV_KERNEL_MODULES="nvidia" failed with the following outpu>
make[1]: Entering directory '/usr/src/linux-headers-7.0.4+deb13-common'
make[2]: Entering directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
MODPOST Module.symvers
WARNING: modpost: missing MODULE_DESCRIPTION() in nvidia.o
LD [M] nvidia.ko
BTF [M] nvidia.ko
awk: cmd. line:1: 'BEGIN
awk: cmd. line:1: ^ invalid char ''' in expression
make[4]: *** [/usr/src/linux-headers-7.0.4+deb13-common/scripts/Makefile.modfinal:62: nvidia.ko] Error 1
make[4]: *** Deleting file 'nvidia.ko'
make[4]: Target '__modfinal' not remade because of errors.
make[3]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:2061: modules] Error 2
make[2]: *** [/usr/src/linux-headers-7.0.4+deb13-common/Makefile:260: __sub-make] Error 2
make[2]: Target 'modules' not remade because of errors.
make[2]: Leaving directory '/tmp/makeself.lqVvwlTi/NVIDIA-Linux-x86_64-595.45.04/kernel-open'
make[1]: *** [Makefile:260: __sub-make] Error 2
make[1]: Target 'modules' not remade because of errors.
make[1]: Leaving directory '/usr/src/linux-headers-7.0.4+deb13-common'
make: *** [Makefile:138: modules] Error 2
ERROR: The nvidia kernel module was not created.
ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

Anyone found a way to fix it?
 
Last edited:


And just days ago you argued Nvidia isn't a problem... And now you keep finding them.


 
What I do on my debian system (I dont have any Mint currently).

Code:
# Add the graphics-drivers PPA
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

# See what's recommended for your GPU
ubuntu-drivers devices

# Install the recommended driver (e.g. nvidia-driver-570)
sudo apt install nvidia-driver-570

Not sure this works with Mint
Code:
# Ensure non-free and non-free-firmware are in your sources
sudo apt edit-sources
# Add "non-free non-free-firmware" after "main contrib" on your repo lines

sudo apt update
sudo apt install nvidia-driver firmware-misc-nonfree

Code:
# Installed driver version
nvidia-smi

# What the package manager knows about
apt list --installed | grep nvidia

# What's available (Mint/Ubuntu)
apt-cache search nvidia-driver | grep "^nvidia-driver"

I don't run upstream kernels or upstream nvidia drivers. I stick with the repo "default" versions.
This seems to work.

Debian is well known for being a few months behind the curve. Mint/Ubuntu less so.

Just my 2 cents. - If wanted to run newer kernels and newer drivers, why not just pick a distro
that does this by default?
 
If wanted to run newer kernels and newer drivers, why not just pick a distro
that does this by default?
That makes perfect sense.
 
you argued Nvidia isn't a problem
This is first time I'm not able to solve a problem with Nvidia, and it's not clear whether it's driver problem, build script or kernel headers package.

However I'm now investigating build scripts, if I fix it I'll let you know for the sake of the argument ;)

I don't run upstream kernels or upstream nvidia drivers. I stick with the repo "default" versions.
This seems to work.
why not just pick a distro
that does this by default?
I had bad experience with debian's default nv driver.
driver works but it's too old, I want my games to run on latest and greatest.

Debian should really make an exception when it comes to GPU drivers, it's a single package that should always be up to date, it shouldn't be hard for them since the driver doesn't depend on any other packages, so keeping it up to date should be easy.
Why they stick with ancient driver?
 
This is first time I'm not able to solve a problem with Nvidia, and it's not clear whether it's driver problem, build script or kernel headers package.

However I'm now investigating build scripts, if I fix it I'll let you know for the sake of the argument ;)
My point has already been proven.

Radeon = fewer problems
NVIDIA = more problems

There’s really nothing more to add. If you want a stable, trouble-free experience, NVIDIA is usually not the route to take. You chose it, so I wish you luck resolving the issue.

The same applies to new users moving to Linux. Going with NVIDIA carries a much higher risk of problems they may not be able to fix themselves, which can easily push them back to Windows.
 
Debian should really make an exception when it comes to GPU drivers
Why they stick with ancient driver?

Debian will not bend their rules because your GPU proprietary driver demands and quicks. Debian ships what's available, and then you get to use it for 2 years.

Sometimes, you find newer version in backports, though. Have you checked that?

Don't forget what Linus Torvalds said about Nvidia:

1778950071690.png


By ignoring his warning, you are bringing these problems upon yourself.
 
Debian should really make an exception when it comes to GPU drivers, it's a single package that should always be up to date

That would be nice... but in many cases, the drivers are tied to the kernel versions.
595 won't install on my older kernels.. (I'm not sure where the line is, 6.17 doesn't work)
6.18? maybe.. I dont remember.. seems like I had to use 580. 6.19 works with 595, but doesn't include
all blackwell updates. 7.0.4 has the blackwell updates.

Same with Radeon, most of the drivers are in the kernel itself.. so if I want a newer driver,
I have to run a newer kernel.

The bottom line.. drivers are tied to specific kernels.
 
Last edited:
My point has already been proven.

Radeon = fewer problems
NVIDIA = more problems

There’s really nothing more to add. If you want a stable, trouble-free experience, NVIDIA is usually not the route to take. You chose it, so I wish you luck resolving the issue.
if I fix it I'll let you know for the sake of the argument ;)

it's fixed:

nvidia.png


Latest kernel with latest driver, typing RN from it, so your argument remains null and void hah!

That picture with Linus showing a middle finger is from times when drivers were closed, but why would I debate with you? there already was a debate in another thread and you learned nothing from it.

Here's is what needs to be done:

Bash:
sudo nano /usr/src/linux-headers-$(uname -r | sed 's/-amd64$//')-common/scripts/Makefile.modfinal

Here find code block that says this and comment it out:
Bash:
cmd_btf_ko =                                                   \
if [ ! -f $(objtree)/vmlinux ]; then                           \
     printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
else   \
     $(CONFIG_SHELL) $(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
fi;

Insert the following instead:
Bash:
cmd_btf_ko = \
if [ ! -f $(objtree)/vmlinux ]; then \
printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
elif echo "$@" | grep -q "nvidia"; then \
printf "Skipping BTF generation for %s for Nvidia module\n" $@ 1>&2; \
else \
$(CONFIG_SHELL) $(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
fi

Reason you want to comment out instead of replacing is because you can easily undo changes once this is resolved upstream.

What's happening? and why is this needed?

Btw. I stole this solution from HERE however it's not working, had to slightly adjust it because make recipe continued to fail.

What is BPF?

TL;DR
It's used for debugging, we disabled it, it's not needed.
 
That picture with Linus showing a middle finger is from times when drivers were closed, but why would I debate with you? there already was a debate in another thread and you learned nothing from it.
I don't need to learn anything from Nvidia debugging and troubleshooting, I am not putting myself to this scenario. It is you who is throwing this obstacle under your own feet.

Open or not, you are forced to troubleshoot these problems because of your poor decisions.

I do nothing to my drivers - I install the system, use it as long as I like, to reinstall couple of years later if I decide to switch, distro hop or whatever. Drivers do not bother me, they just work 100% of the time. Sorry that you don't have it the same way.
 
If you used PikaOS instead of Debian or the Nvidia cuda repo for updating your drivers you would have an easier time, as they fix such things in the packaged format version of the driver without you having to do anything. But I know you prefer to install and update drivers manually, so it's something you won't do. But thought it would be worth mentioning anyways ;)
 
Nvidia cuda repo
Yes it must work since cuda repo ships *.deb packages.
But it's cool to see dkms build sources, you get fresh fish instead of frozen one ;)

This is just one problem in last 2.5 years, there was another one but easier to fix, 2 problems in 2 years is no problem.
 


Follow Linux.org

Members online


Top