2

I am trying to set up CUDA on my new Ubuntu 22.04 machine and following the instructions as per, official Nvidia guide But I get this when I try to install any package after CUDA installation.

I tried running sudo apt --fix-broken install but got this error log.

atif@aihwkit:~$ uname -r
5.15.0-43-generic
atif@aihwkit:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
linux-headers-5.15.0-43-generic is already the newest version (5.15.0-43.46).
linux-headers-5.15.0-43-generic set to manually installed.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-drivers-515 : Depends: libnvidia-compute-515 (>= 515.48.07) but it is not going to be installed
                    Depends: nvidia-compute-utils-515 (>= 515.48.07) but it is not going to be installed
                    Depends: nvidia-kernel-common-515 (>= 515.48.07) but it is not going to be installed
                    Depends: nvidia-utils-515 (>= 515.48.07) but it is not going to be installed
 libnvidia-decode-515 : Depends: libnvidia-compute-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
 nvidia-dkms-515 : Depends: nvidia-kernel-common-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
 nvidia-driver-515 : Depends: libnvidia-compute-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
                     Depends: libnvidia-extra-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
                     Depends: nvidia-compute-utils-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
                     Depends: nvidia-utils-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
                     Depends: libnvidia-cfg1-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
                     Recommends: libnvidia-compute-515:i386 (= 515.48.07-0ubuntu1)
                     Recommends: libnvidia-decode-515:i386 (= 515.48.07-0ubuntu1)
                     Recommends: libnvidia-encode-515:i386 (= 515.48.07-0ubuntu1)
                     Recommends: libnvidia-fbc1-515:i386 (= 515.48.07-0ubuntu1)
                     Recommends: libnvidia-gl-515:i386 (= 515.48.07-0ubuntu1)
 xserver-xorg-video-nvidia-515 : Depends: libnvidia-cfg1-515 (= 515.48.07-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
atif@aihwkit:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libnvidia-cfg1-515 libnvidia-compute-515 libnvidia-extra-515 nvidia-compute-utils-515
  nvidia-kernel-common-515 nvidia-utils-515
The following NEW packages will be installed:
  libnvidia-cfg1-515 libnvidia-compute-515 libnvidia-extra-515 nvidia-compute-utils-515
  nvidia-kernel-common-515 nvidia-utils-515
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
208 not fully installed or removed.
Need to get 67.5 MB of archives.
After this operation, 236 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  libnvidia-compute-515 515.48.07-0ubuntu1 [45.0 MB]
Get:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  nvidia-compute-utils-515 515.48.07-0ubuntu1 [271 kB]
Get:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  nvidia-kernel-common-515 515.48.07-0ubuntu1 [21.7 MB]
Get:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  libnvidia-extra-515 515.48.07-0ubuntu1 [56.8 kB]
Get:5 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  nvidia-utils-515 515.48.07-0ubuntu1 [337 kB]
Get:6 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  libnvidia-cfg1-515 515.48.07-0ubuntu1 [85.4 kB]
Fetched 67.5 MB in 3s (20.9 MB/s)             
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 80853 files and directories currently installed.)
Preparing to unpack .../0-libnvidia-compute-515_515.48.07-0ubuntu1_amd64.deb ...
Unpacking libnvidia-compute-515:amd64 (515.48.07-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-87d4eZ/0-libnvidia-compute-515_515.48.07-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/lib/x86_64-linux-gnu/libcuda.so.515.48.07' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../1-nvidia-compute-utils-515_515.48.07-0ubuntu1_amd64.deb ...
Unpacking nvidia-compute-utils-515 (515.48.07-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-87d4eZ/1-nvidia-compute-utils-515_515.48.07-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/nvidia-cuda-mps-control' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../2-nvidia-kernel-common-515_515.48.07-0ubuntu1_amd64.deb ...
Unpacking nvidia-kernel-common-515 (515.48.07-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-87d4eZ/2-nvidia-kernel-common-515_515.48.07-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './lib/firmware/nvidia/515.48.07/gsp.bin' before installing new version: Invalid cross-device link
Preparing to unpack .../3-libnvidia-extra-515_515.48.07-0ubuntu1_amd64.deb ...
Unpacking libnvidia-extra-515:amd64 (515.48.07-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-87d4eZ/3-libnvidia-extra-515_515.48.07-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.515.48.07' before installing new version: Invalid cross-device link
Preparing to unpack .../4-nvidia-utils-515_515.48.07-0ubuntu1_amd64.deb ...
Unpacking nvidia-utils-515 (515.48.07-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-87d4eZ/4-nvidia-utils-515_515.48.07-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/nvidia-debugdump' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../5-libnvidia-cfg1-515_515.48.07-0ubuntu1_amd64.deb ...
Unpacking libnvidia-cfg1-515:amd64 (515.48.07-0ubuntu1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-87d4eZ/5-libnvidia-cfg1-515_515.48.07-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.515.48.07' before installing new version: Invalid cross-device link
Errors were encountered while processing:
 /tmp/apt-dpkg-install-87d4eZ/0-libnvidia-compute-515_515.48.07-0ubuntu1_amd64.deb
 /tmp/apt-dpkg-install-87d4eZ/1-nvidia-compute-utils-515_515.48.07-0ubuntu1_amd64.deb
 /tmp/apt-dpkg-install-87d4eZ/2-nvidia-kernel-common-515_515.48.07-0ubuntu1_amd64.deb
 /tmp/apt-dpkg-install-87d4eZ/3-libnvidia-extra-515_515.48.07-0ubuntu1_amd64.deb
 /tmp/apt-dpkg-install-87d4eZ/4-nvidia-utils-515_515.48.07-0ubuntu1_amd64.deb
 /tmp/apt-dpkg-install-87d4eZ/5-libnvidia-cfg1-515_515.48.07-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Atif
  • 594

1 Answers1

1

Update:

Consider using a deep-learning docker image available at,

https://github.com/matifali/dockerdl

Old solution:

After trying many things, I was unable to solve the dependencies problem. Finally, I ended up using the official Nvidia CUDA image and installed my requirements on top of that.

Use the devel version if you are thinking of building something from the source.

I used,

nvidia/cuda:11.7.1-devel-ubuntu22.04

Atif
  • 594