CUDA drivers installation errors | Kubuntu 24.04 | RTX 4070 Laptop GPU

I am running a kubuntu 24.04 machine with an RTX 4070 Laptop GPU. I tried installing CUDA using the web installation method and the local installation method but I keep running into driver issues. I tried using the .run file but I got a warning that there is a better way and using the .run file could cause breaking changes. When trying to run sudo apt install cuda-toolkit, I get the following errors:
Errors were encountered while processing:
nvidia-dkms-560
nvidia-driver-560
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems that nvidia-dkms-560 isn’t configured and nvidia-driver-560 depends on nvidia-dkms-560 to be configured.

Running sudo dpkg --configure nvidia-dkms-560 says the following:
Building initial module for 6.8.0-45-generic
Error! Bad return status for module build on kernel: 6.8.0-45-generic (x86_64)
Consult /var/lib/dkms/nvidia/560.35.03/build/make.log for more information.
dpkg: error processing package nvidia-dkms-560 (–configure):
installed nvidia-dkms-560 package post-installation script subprocess returned error exit status 10

I’ve attached the generated make.log crash file. I’m not entirely sure how to understand the crash file and it’s pretty much complete gibberish to me.

I’d really appreciate any help in the installation process, thank you!

make.log (41.3 KB)

The first thing before installing Cuda, is to check your system meets the requirements.

Looking at the top of the make.log, it warns you the compiler installed is not the same as was used to compile the kernel.

At the end, it bails on an unsupported compiler option. This is probably caused by the above.

How would I solve this then? My gcc version when running gcc --version comes up as gcc (Ubuntu 11.4.0-9ubuntu1) 11.4.0 but the requirements page says I need 13.2.0. I ran sudo apt install --reinstall gcc-13 to install gcc-13 but it didn’t seem to do anything, I still have gcc 11.4.0 running. Thank you for your help!

As a Redhat guy, I have no (K)ubuntu knowledge. I looked at the supported OS versions and saw Kubuntu is not there and a quick check told me Kubuntu is the same as Ubuntu of the same version, but using KDE.

Clearly it looks like at least the compiler is different, so you will need to find a way to install the supported version, via packages or compile from source.

I’m quite new to the linux world and have no idea how to compile it from source or via packages. How would I go about doing that? Thank you again!

The least fuss way of dealing with it all would be to choose a supported OS - perhaps Ubuntu 24.04.z (z <= 1) LTS.