Can't install cuda 11.8 on ubuntu 22.04 lts

I have a RTX 4090 GPU on a machine with Ubuntu 22.04 lts.
I can load it with its default kernel 6.20-26 or with kernel 5.19.0-32.
I load it with kernel 5.19.0-32 because I want to install Cuda 11.8 for Pytorch.
In my ‘additional driver’ I can find driver 535 and 525 but not 520.

The installation of Cuda 11.8 fail and I get the following errors:
A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau
from loading. This can be reverted by deleting the following file:
/etc/modprobe.d/nvidia-graphics-drivers.conf

A new initrd image has also been created. To revert, please regenerate your
initrd by running the following command after deleting the modprobe.d file:
/usr/sbin/initramfs -u


*** Reboot your computer and verify that the NVIDIA graphics driver can ***
*** be loaded. ***


INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Loading new nvidia-520.61.05 DKMS files…
Building for 5.19.0-32-generic 6.2.0-26-generic
Building for architecture x86_64
Building initial module for 5.19.0-32-generic
ERROR (dkms apport): kernel package linux-headers-5.19.0-32-generic is not supported
Error! Application of patch disable_fstack-clash-protection_fcf-protection.patch failed.
Check /var/lib/dkms/nvidia/520.61.05/build/ for more information.
dpkg: error processing package nvidia-dkms-520 (–configure):
installed nvidia-dkms-520 package post-installation script subprocess returned error exit status 6
Setting up cuda-nvprof-11-8 (11.8.87-1) …
Setting up nsight-compute-2022.3.0 (2022.3.0.22-1) …
Setting up libwayland-client0:i386 (1.20.0-1ubuntu0.1) …
Setting up nsight-systems-2022.4.2 (2022.4.2.1-df9881f) …
update-alternatives: using /opt/nvidia/nsight-systems/2022.4.2/target-linux-x64/nsys to provide /usr/local/bin/nsys (nsys) in auto mode
update-alternatives: using /opt/nvidia/nsight-systems/2022.4.2/host-linux-x64/nsys-ui to provide /usr/local/bin/nsys-ui (nsys-ui) in auto mode
Setting up libnvidia-decode-520:amd64 (520.61.05-0ubuntu1) …
Setting up libnvidia-decode-520:i386 (520.61.05-0ubuntu1) …
Setting up libcusparse-11-8 (11.7.5.86-1) …
Setting up default-jre-headless (2:1.11-72build2) …
Setting up libcufft-11-8 (10.9.0.58-1) …
Setting up cuda-cupti-dev-11-8 (11.8.87-1) …
Setting up libcufft-dev-11-8 (10.9.0.58-1) …
Setting up cuda-cudart-dev-11-8 (11.8.89-1) …
Setting up libnpp-11-8 (11.8.0.86-1) …
Setting up libcusolver-dev-11-8 (11.4.1.48-1) …
dpkg: dependency problems prevent configuration of cuda-drivers-520:
cuda-drivers-520 depends on nvidia-dkms-520 (>= 520.61.05); however:
Package nvidia-dkms-520 is not configured yet.

dpkg: error processing package cuda-drivers-520 (–configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Setting up xserver-xorg-video-nvidia-520 (520.61.05-0ubuntu1) …
Setting up default-jre (2:1.11-72build2) …
Setting up libnvidia-encode-520:amd64 (520.61.05-0ubuntu1) …
Setting up libnvidia-encode-520:i386 (520.61.05-0ubuntu1) …
Setting up cuda-nsight-systems-11-8 (11.8.0-1) …
Setting up cuda-command-line-tools-11-8 (11.8.0-1) …
Setting up libcusparse-dev-11-8 (11.7.5.86-1) …
Setting up libegl-mesa0:i386 (23.0.4-0ubuntu1~22.04.1) …
Setting up libcurand-11-8 (10.3.0.86-1) …
Setting up cuda-nvvp-11-8 (11.8.87-1) …
Setting up libcufile-11-8 (1.4.0.31-1) …
Setting alternatives
update-alternatives: using /usr/local/cuda-11.8/gds/cufile.json to provide /etc/cufile.json (cufile.json) in auto mode
Setting up libcublas-11-8 (11.11.3.6-1) …
Setting up libnpp-dev-11-8 (11.8.0.86-1) …
Setting up cuda-libraries-11-8 (11.8.0-1) …
dpkg: dependency problems prevent configuration of cuda-drivers:
cuda-drivers depends on cuda-drivers-520 (= 520.61.05-1); however:
Package cuda-drivers-520 is not configured yet.

dpkg: error processing package cuda-drivers (–configure):
dependency problems - leaving unconfigured
Setting up cuda-nsight-compute-11-8 (11.8.0-1) …
No apport report written because the error message indicates its a followup error from a previous failure.
Setting up cuda-nsight-11-8 (11.8.86-1) …
Setting up libegl1:i386 (1.4.0-1) …
Setting up libnvjpeg-dev-11-8 (11.9.0.86-1) …
Setting up cuda-nvcc-11-8 (11.8.89-1) …
dpkg: dependency problems prevent configuration of nvidia-driver-520:
nvidia-driver-520 depends on nvidia-dkms-520 (= 520.61.05-0ubuntu1); however:
Package nvidia-dkms-520 is not configured yet.

dpkg: error processing package nvidia-driver-520 (–configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Setting up libcublas-dev-11-8 (11.11.3.6-1) …
Setting up libcurand-dev-11-8 (10.3.0.86-1) …
Setting up libcufile-dev-11-8 (1.4.0.31-1) …
dpkg: dependency problems prevent configuration of cuda-runtime-11-8:
cuda-runtime-11-8 depends on cuda-drivers (>= 520.61.05); however:
Package cuda-drivers is not configured yet.

dpkg: error processing package cuda-runtime-11-8 (–configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Setting up libnvidia-gl-520:i386 (520.61.05-0ubuntu1) …
Setting up cuda-compiler-11-8 (11.8.0-1) …
dpkg: dependency problems prevent configuration of cuda-11-8:
cuda-11-8 depends on cuda-runtime-11-8 (>= 11.8.0); however:
Package cuda-runtime-11-8 is not configured yet.

dpkg: error processing package cuda-11-8 (–configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-demo-suite-11-8:
cuda-demo-suite-11-8 depends on cuda-runtime-11-8; however:
Package cuda-runtime-11-8 is not configured yet.

dpkg: error processing package cuda-demo-suite-11-8 (–configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of cuda:
cuda depends on cuda-11-8 (>= 11.8.0); however:
Package cuda-11-8 is not configured yet.

dpkg: error processing package cuda (–configure):
dependency problems - leaving unconfigured
Setting up cuda-libraries-dev-11-8 (11.8.0-1) …
No apport report written because MaxReports is reached already
Setting up cuda-visual-tools-11-8 (11.8.0-1) …
Setting up cuda-tools-11-8 (11.8.0-1) …
Setting up cuda-toolkit-11-8 (11.8.0-1) …
Setting alternatives
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu3) …
Processing triggers for libc-bin (2.35-0ubuntu3.1) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for dbus (1.12.20-2ubuntu4.1) …
Processing triggers for mailcap (3.70+nmu1ubuntu1) …
Processing triggers for desktop-file-utils (0.26-1ubuntu3) …
Processing triggers for initramfs-tools (0.140ubuntu13.1) …
update-initramfs: Generating /boot/initrd.img-6.2.0-26-generic
Errors were encountered while processing:
nvidia-dkms-520
cuda-drivers-520
cuda-drivers
nvidia-driver-520
cuda-runtime-11-8
cuda-11-8
cuda-demo-suite-11-8
cuda
E: Sub-process /usr/bin/dpkg returned an error code (1)

Is there a way to install cuda11.8 on my machine?

This may be due to the supported kernel for 11.8 on Ubuntu 22.04 lts being 5.15.0-25, according to the installation guide.

Hi,
did it help to change the kernel version?
I’m facing exactly the same issue.
How did you go back to an old kernel version?

1 Like

I met the same problem and successfully install the toolkit by using the runfile without installing the driver. Hope this help.

wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run

3 Likes

Thank you.

That helped in my case. CUDA 11.8 with cuDNN 8.9.5 is working on driver 535, ubuntu 22.04 kernel 6.32

When executing the .run file, I receive the following output at the end of the process:

===========
= Summary =
===========

Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-11.8/

Please make sure that
** - PATH includes /usr/local/cuda-11.8/bin**
** - LD_LIBRARY_PATH includes /usr/local/cuda-11.8/lib64, or, add /usr/local/cuda-11.8/lib64 to /etc/ld.so.conf and run ldconfig as root**

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.8/bin
*WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 520.00 is required for CUDA 11.8 functionality to work.
To install the driver using this installer, run the following command, replacing with the name of this run file:
** sudo .run --silent --driver

Logfile is /var/log/cuda-installer.log

My system is:
NAME=“Ubuntu”
VERSION_ID=“22.04”
VERSION=“22.04.3 LTS (Jammy Jellyfish)”
VERSION_CODENAME=jammy
Kernel: 6.2.0-32-generic

**Drive NVIDIA: **
**Driver Version: 535.104.05 **
CUDA Version: 12.2

Does anyone know how to solve this problem?

you can ofer the recipe?

After this you used the sudo sh cuda_11.8.0_520.61.05_linux.run to run it ? I have tried this and for some reason my terminal hangs