更新:

更新:

我正在尝试在新的 Ubuntu 22.04 机器上设置 CUDA,并按照以下说明进行操作,官方 Nvidia 指南 但是当我在安装 CUDA 后尝试安装任何包时都会出现这种情况。

我尝试运行sudo apt --fix-broken install但出现此错误日志。

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)

答案1

更新:

考虑使用深度学习 docker 镜像,网址为:

https://github.com/matifali/dockerdl

旧解决方案:

尝试了很多方法后,我还是无法解决依赖问题。最后,我使用了官方 Nvidia CUDA 映像并在其之上安装了我的要求。

如果您想从源代码构建某些东西,请使用开发版本。

我用了,

nvidia/cuda:11.7.1-devel-ubuntu22.04

相关内容