Attempting to install 340.108 driver in Kali linux failure Dell D830

As the title suggests, I am trying to install Nvidia 340.108 driver in my Dell D830.

Simply following Kali forum instruction yields no results.

sudo apt install -y nvidia-driver automatically installs 430.xx drivers and has no effect on graphics. On reboot an error is logged on screen stating that my 430 drivers will be ignored and that I should install 340.xx.

‘sudo apt install nvidia-legacy-340xx-driver’
‘sudo apt install nvidia-settings-legacy340xx’
‘sudo apt install nvidia-340xx-driver’
‘sudo apt install nvidia-340xx’

all fail with “Unable to locate package”

"sudo add-apt-repository ppa:graphics-drivers/ppa’

and then also running those comands still fails with “Unable to locate package”

Downloading the .run file for the 340.108 driver and running it sommewhat works, the driver half" installs and fails with errors but has VERY poor performance and running like a slideshow.

Any assistance would be appreciated.

I had a look at the KALI forums, some folks experienced issues with the nouveau potentially interfering, so perhaps its trying to remove that , and then run the installation? It does seem a lot of users are successfully using nvidia drivers in their Kali installations - so I would be surprised you are the first person hitting this issue have you tried to post your question there too ?

Nouveau is not the problem I am having.

Attached here is the “important bit” of my nvidia-installer.log

-> Driver file installation is complete.
-> Installing DKMS kernel module:
ERROR: Failed to run `/usr/sbin/dkms build -m nvidia -v 340.108 -k 5.16.0-kali7-amd64`: 
Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j2 KERNELRELEASE=5.16.0-kali7-amd64 module KERNEL_UNAME=5.16.0-kali7-amd64; make -C uvm module KERNEL_UNAME=5.16.0-kali7-amd64 KBUILD_EXTMOD=/var/lib/dkms/nvidia/340.108/build/uvm...(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.16.0-kali7-amd64 (x86_64)
Consult /var/lib/dkms/nvidia/340.108/build/make.log for more information.
-> error.
ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try installing again without DKMS, or check the DKMS logs for more information.
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.

and here is the whole make.log

DKMS make.log for nvidia-340.108 for kernel 5.16.0-kali7-amd64 (x86_64)
Thu Jun  9 07:19:41 PDT 2022

gcc-version-check failed:

The compiler used to compile the kernel (gcc
11.2) does not exactly match the current compiler
(gcc 11.3).  The Linux 2.6 kernel module loader
rejects kernel modules built with a version of gcc
that does not exactly match that of the compiler
used to build the running kernel.

If you know what you are doing and want to override
the gcc version check, you can do so by setting the
IGNORE_CC_MISMATCH environment variable to "1".

In any other case, set the CC environment variable
to the name of the compiler that was used to compile
the kernel.

*** Failed CC version check. Bailing out! ***

make: *** [nvidia-modules-common.mk:201: build-sanity-checks] Error 1
make: Entering directory '/var/lib/dkms/nvidia/340.108/build/uvm'
cd ./..; make module SYSSRC=/lib/modules/5.16.0-kali7-amd64/source SYSOUT=/lib/modules/5.16.0-kali7-amd64/build KBUILD_EXTMOD=./..
make[1]: Entering directory '/var/lib/dkms/nvidia/340.108/build'
NVIDIA: calling KBUILD...
make[2]: Entering directory '/usr/src/linux-headers-5.16.0-kali7-common'
make -C /usr/src/linux-headers-5.16.0-kali7-amd64 -f /usr/src/linux-headers-5.16.0-kali7-common/Makefile modules
make[3]: Entering directory '/usr/src/linux-headers-5.16.0-kali7-amd64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
echo >&2;							\
echo >&2 "  ERROR: Kernel configuration is invalid.";		\
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
echo >&2 ;							\
/bin/false)
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.2.0-19) 11.2.0
  You are using:           gcc-11 (Debian 11.3.0-3) 11.3.0
make -f /usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build obj=.. \
single-build= \
need-builtin=1 need-modorder=1
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
/usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build:44: /usr/src/linux-headers-5.16.0-kali7-common/../Makefile: No such file or directory
make[4]: *** No rule to make target '/usr/src/linux-headers-5.16.0-kali7-common/../Makefile'.  Stop.
make[3]: *** [/usr/src/linux-headers-5.16.0-kali7-common/Makefile:1870: ..] Error 2
make[3]: Leaving directory '/usr/src/linux-headers-5.16.0-kali7-amd64'
make[2]: *** [Makefile:231: __sub-make] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.16.0-kali7-common'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make[1]: *** [Makefile:197: nvidia.ko] Error 1
make[1]: Leaving directory '/var/lib/dkms/nvidia/340.108/build'
make: *** [Makefile:221: ../Module.symvers] Error 2
make: Leaving directory '/var/lib/dkms/nvidia/340.108/build/uvm'

so apparantly my problem is a gcc version check

As it’s a minor compiler version change, try to set that that variable (guessing in the dkms.conf).

I suspected to try that…

I changed /var/lib/dkms/nvidia/340.108/build/

Added IGNORE_CC_MISMATCH=1

AND then it “ALMOST” worked. Took a lot longer to kick out a fail log.


DKMS make.log for nvidia-340.108 for kernel 5.16.0-kali7-amd64 (x86_64)
Thu Jun  9 11:02:14 AM PDT 2022
NVIDIA: calling KBUILD...
make[1]: Entering directory '/usr/src/linux-headers-5.16.0-kali7-common'
make -C /usr/src/linux-headers-5.16.0-kali7-amd64 -f /usr/src/linux-headers-5.16.0-kali7-common/Makefile modules
make[2]: Entering directory '/usr/src/linux-headers-5.16.0-kali7-amd64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
echo >&2;							\
echo >&2 "  ERROR: Kernel configuration is invalid.";		\
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
echo >&2 ;							\
/bin/false)
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.2.0-19) 11.2.0
  You are using:           gcc-11 (Debian 11.3.0-3) 11.3.0
make -f /usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build obj=/var/lib/dkms/nvidia/340.108/build \
single-build= \
need-builtin=1 need-modorder=1
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
  gcc-11 -Wp,-MMD,/var/lib/dkms/nvidia/340.108/build/.nv-acpi.o.d -nostdinc -I/usr/src/linux-headers-5.16.0-kali7-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.16.0-kali7-common/include -I./include -I/usr/src/linux-headers-5.16.0-kali7-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.16.0-kali7-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.16.0-kali7-common/include/linux/compiler-version.h -include /usr/src/linux-headers-5.16.0-kali7-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.16.0-kali7-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-5.16.0-kali7-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -DNV_MODULE_INSTANCE=0 -DNV_BUILD_MODULE_INSTANCES=0 -UDEBUG -U_DEBUG -DNDEBUG -I/var/lib/dkms/nvidia/340.108/build -Wall -MD -Wsign-compare -Wno-cast-qual -Wno-error -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"340.108\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -D__linux__ -DNV_DEV_NAME=\"nvidia\"  -DMODULE  -DKBUILD_BASENAME='"nv_acpi"' -DKBUILD_MODNAME='"nvidia"' -D__KBUILD_MODNAME=kmod_nvidia -c -o /var/lib/dkms/nvidia/340.108/build/nv-acpi.o /var/lib/dkms/nvidia/340.108/build/nv-acpi.c  ; ./tools/objtool/objtool orc generate  --module  --no-fp   --retpoline  --uaccess  /var/lib/dkms/nvidia/340.108/build/nv-acpi.o
  gcc-11 -Wp,-MMD,/var/lib/dkms/nvidia/340.108/build/.nv-chrdev.o.d -nostdinc -I/usr/src/linux-headers-5.16.0-kali7-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.16.0-kali7-common/include -I./include -I/usr/src/linux-headers-5.16.0-kali7-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.16.0-kali7-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.16.0-kali7-common/include/linux/compiler-version.h -include /usr/src/linux-headers-5.16.0-kali7-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.16.0-kali7-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-5.16.0-kali7-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -DNV_MODULE_INSTANCE=0 -DNV_BUILD_MODULE_INSTANCES=0 -UDEBUG -U_DEBUG -DNDEBUG -I/var/lib/dkms/nvidia/340.108/build -Wall -MD -Wsign-compare -Wno-cast-qual -Wno-error -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"340.108\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -D__linux__ -DNV_DEV_NAME=\"nvidia\"  -DMODULE  -DKBUILD_BASENAME='"nv_chrdev"' -DKBUILD_MODNAME='"nvidia"' -D__KBUILD_MODNAME=kmod_nvidia -c -o /var/lib/dkms/nvidia/340.108/build/nv-chrdev.o /var/lib/dkms/nvidia/340.108/build/nv-chrdev.c  ; ./tools/objtool/objtool orc generate  --module  --no-fp   --retpoline  --uaccess  /var/lib/dkms/nvidia/340.108/build/nv-chrdev.o
In file included from /var/lib/dkms/nvidia/340.108/build/nv-acpi.c:14:
/var/lib/dkms/nvidia/340.108/build/os-interface.h:27:10: fatal error: stdarg.h: No such file or directory
   27 | #include <stdarg.h>
      |          ^~~~~~~~~~
compilation terminated.
make[3]: *** [/usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build:292: /var/lib/dkms/nvidia/340.108/build/nv-acpi.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /var/lib/dkms/nvidia/340.108/build/nv-chrdev.c:14:
/var/lib/dkms/nvidia/340.108/build/os-interface.h:27:10: fatal error: stdarg.h: No such file or directory
   27 | #include <stdarg.h>
      |          ^~~~~~~~~~
compilation terminated.
make[3]: *** [/usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build:292: /var/lib/dkms/nvidia/340.108/build/nv-chrdev.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.16.0-kali7-common/Makefile:1870: /var/lib/dkms/nvidia/340.108/build] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.16.0-kali7-amd64'
make[1]: *** [Makefile:231: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.16.0-kali7-common'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make: *** [Makefile:197: nvidia.ko] Error 1
make: Entering directory '/var/lib/dkms/nvidia/340.108/build/uvm'
cd ./..; make module SYSSRC=/lib/modules/5.16.0-kali7-amd64/source SYSOUT=/lib/modules/5.16.0-kali7-amd64/build KBUILD_EXTMOD=./..
make[1]: Entering directory '/var/lib/dkms/nvidia/340.108/build'
NVIDIA: calling KBUILD...
make[2]: Entering directory '/usr/src/linux-headers-5.16.0-kali7-common'
make -C /usr/src/linux-headers-5.16.0-kali7-amd64 -f /usr/src/linux-headers-5.16.0-kali7-common/Makefile modules
make[3]: Entering directory '/usr/src/linux-headers-5.16.0-kali7-amd64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
echo >&2;							\
echo >&2 "  ERROR: Kernel configuration is invalid.";		\
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
echo >&2 ;							\
/bin/false)
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.2.0-19) 11.2.0
  You are using:           gcc-11 (Debian 11.3.0-3) 11.3.0
make -f /usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build obj=.. \
single-build= \
need-builtin=1 need-modorder=1
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
/usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build:44: /usr/src/linux-headers-5.16.0-kali7-common/../Makefile: No such file or directory
make[4]: *** No rule to make target '/usr/src/linux-headers-5.16.0-kali7-common/../Makefile'.  Stop.
make[3]: *** [/usr/src/linux-headers-5.16.0-kali7-common/Makefile:1870: ..] Error 2
make[3]: Leaving directory '/usr/src/linux-headers-5.16.0-kali7-amd64'
make[2]: *** [Makefile:231: __sub-make] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.16.0-kali7-common'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make[1]: *** [Makefile:197: nvidia.ko] Error 1
make[1]: Leaving directory '/var/lib/dkms/nvidia/340.108/build'
make: *** [Makefile:221: ../Module.symvers] Error 2
make: Leaving directory '/var/lib/dkms/nvidia/340.108/build/uvm'

I checked to see if those files are indeed missing, but they are NOT missing. WTF?

The 340 driver is out of support now for several years, it doesn’t compile against recent kernels and doesn’t support anything beyond Xorg 1.20, probably being tthe reason why it was removed from the debian repo.

hmm something somthing…

Current Status

Current long-lived branch release: nvidia-430 (430.40)
Dropped support for Fermi series (List of Fermi series GeForce GPUs | NVIDIA)

Old long-lived branch release: nvidia-390 (390.129)

For GF1xx GPUs use nvidia-390 (390.129)
For G8x, G9x and GT2xx GPUs use nvidia-340 (340.107)
For NV4x and G7x GPUs use nvidia-304 (304.137) End-Of-Life!

perhaps the repository isnt actually adding itself…

sudo apt update
Get:1 edit://ppa.launchpad.net/graphics-drivers/ppa/ubuntu kinetic InRelease [24.4 kB]
Get:2 edit://kali.download/kali kali-rolling InRelease [30.6 kB]
Err:1 edit://ppa.launchpad.net/graphics-drivers/ppa/ubuntu kinetic InRelease
The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY > FCAE110B1118213C
W: GPG error: edit://ppa.launchpad.net/graphics-drivers/ppa/ubuntu kinetic InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY FCAE110B1118213C
E: The repository ‘edit://ppa.launchpad.net/graphics-drivers/ppa/ubuntu kinetic InRelease’ is not signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

MAJOR EDIT
I was successful in installing the 340.108 driver in UBUNTU 22.04 with
sudo add-apt-repository ppa:kelebek333/nvidia-legacy

Now only to figure out how to do it in Kali