我正在尝试执行apt autoremove
、或apt --fix-broken install
,但遇到了这类错误。这看起来像是一个我无法摆脱的恶性循环。请帮助完全的 Linux 新手。apt upgrade
apt install -f
输出sudo apt-get update
Get:1 file:/var/cuda-repo-ubuntu2204-11-7-local InRelease [1,575 B]
Get:1 file:/var/cuda-repo-ubuntu2204-11-7-local InRelease [1,575 B]
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 110 kB in 1s (202 kB/s)
Reading package lists... Done
输出sudo apt-get upgrade
:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-drivers-515 : Depends: nvidia-compute-utils-515 (>= 515.43.04) but it is not installed
Depends: nvidia-utils-515 (>= 515.43.04) but it is not installed
nvidia-driver-515 : Depends: nvidia-compute-utils-515 (= 515.43.04-0ubuntu1) but it is not installed
Depends: nvidia-utils-515 (= 515.43.04-0ubuntu1) but it is not installed
Recommends: libnvidia-compute-515:i386 (= 515.43.04-0ubuntu1)
Recommends: libnvidia-decode-515:i386 (= 515.43.04-0ubuntu1)
Recommends: libnvidia-encode-515:i386 (= 515.43.04-0ubuntu1)
Recommends: libnvidia-fbc1-515:i386 (= 515.43.04-0ubuntu1)
Recommends: libnvidia-gl-515:i386 (= 515.43.04-0ubuntu1)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
输出apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
javascript-common libaccinj64-11.5 libbabeltrace1 libboost-regex1.74.0 libcub-dev libcublas11 libcublaslt11 libcudart11.0 libcufft10 libcufftw10 libcupti-dev libcupti-doc libcupti11.5 libcurand10
libcusolver11 libcusolvermg11 libcusparse11 libdebuginfod-common libdebuginfod1 libdouble-conversion3 libdw1 libegl-dev libgl-dev libgl1-mesa-dev libgles-dev libgles1 libglvnd-core-dev libglvnd-dev
libglx-dev libipt2 libjs-jquery libjs-sphinxdoc libjs-underscore libnppc11 libnppial11 libnppicc11 libnppidei11 libnppif11 libnppig11 libnppim11 libnppist11 libnppisu11 libnppitc11 libnpps11 libnvblas11
libnvjpeg11 libnvrtc-builtins11.5 libnvrtc11.2 libnvtoolsext1 libnvvm4 libopengl-dev libpcre2-16-0 libpthread-stubs0-dev libpython3.10 libqt5core5a libqt5dbus5 libqt5network5 libsource-highlight-common
libsource-highlight4v5 libtbb-dev libtbb12 libtbbmalloc2 libthrust-dev libvdpau-dev libx11-dev libxau-dev libxcb-xkb1 libxcb1-dev libxdmcp-dev libxkbcommon-x11-0 node-html5shiv nsight-compute
nsight-compute-target nvidia-cuda-gdb nvidia-cuda-toolkit-doc nvidia-opencl-dev ocl-icd-opencl-dev opencl-c-headers opencl-clhpp-headers openjdk-8-jre qttranslations5-l10n x11proto-dev xorg-sgml-doctools
xtrans-dev
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
nvidia-compute-utils-515 nvidia-utils-515
The following NEW packages will be installed:
nvidia-compute-utils-515 nvidia-utils-515
0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded.
7 not fully installed or removed.
Need to get 0 B/608 kB of archives.
After this operation, 1,966 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 file:/var/cuda-repo-ubuntu2204-11-7-local nvidia-compute-utils-515 515.43.04-0ubuntu1 [271 kB]
Get:2 file:/var/cuda-repo-ubuntu2204-11-7-local nvidia-utils-515 515.43.04-0ubuntu1 [337 kB]
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 105126 files and directories currently installed.)
Preparing to unpack .../nvidia-compute-utils-515_515.43.04-0ubuntu1_amd64.deb ...
Unpacking nvidia-compute-utils-515 (515.43.04-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2204-11-7-local/./nvidia-compute-utils-515_515.43.04-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 .../nvidia-utils-515_515.43.04-0ubuntu1_amd64.deb ...
Unpacking nvidia-utils-515 (515.43.04-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2204-11-7-local/./nvidia-utils-515_515.43.04-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)
Errors were encountered while processing:
/var/cuda-repo-ubuntu2204-11-7-local/./nvidia-compute-utils-515_515.43.04-0ubuntu1_amd64.deb
/var/cuda-repo-ubuntu2204-11-7-local/./nvidia-utils-515_515.43.04-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
输出sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of cuda-drivers-515:
cuda-drivers-515 depends on nvidia-compute-utils-515 (>= 515.43.04); however:
Package nvidia-compute-utils-515 is not installed.
cuda-drivers-515 depends on nvidia-utils-515 (>= 515.43.04); however:
Package nvidia-utils-515 is not installed.
dpkg: error processing package cuda-drivers-515 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-drivers:
cuda-drivers depends on cuda-drivers-515 (= 515.43.04-1); however:
Package cuda-drivers-515 is not configured yet.
dpkg: error processing package cuda-drivers (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-driver-515:
nvidia-driver-515 depends on nvidia-compute-utils-515 (= 515.43.04-0ubuntu1); however:
Package nvidia-compute-utils-515 is not installed.
nvidia-driver-515 depends on nvidia-utils-515 (= 515.43.04-0ubuntu1); however:
Package nvidia-utils-515 is not installed.
dpkg: error processing package nvidia-driver-515 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-runtime-11-7:
cuda-runtime-11-7 depends on cuda-drivers (>= 515.43.04); however:
Package cuda-drivers is not configured yet.
dpkg: error processing package cuda-runtime-11-7 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-demo-suite-11-7:
cuda-demo-suite-11-7 depends on cuda-runtime-11-7; however:
Package cuda-runtime-11-7 is not configured yet.
dpkg: error processing package cuda-demo-suite-11-7 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-11-7:
cuda-11-7 depends on cuda-runtime-11-7 (>= 11.7.0); however:
Package cuda-runtime-11-7 is not configured yet.
cuda-11-7 depends on cuda-demo-suite-11-7 (>= 11.7.50); however:
Package cuda-demo-suite-11-7 is not configured yet.
dpkg: error processing package cuda-11-7 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda:
cuda depends on cuda-11-7 (>= 11.7.0); however:
Package cuda-11-7 is not configured yet.
dpkg: error processing package cuda (--configure):
dependency problems - leaving unconfigured
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Errors were encountered while processing:
cuda-drivers-515
cuda-drivers
nvidia-driver-515
cuda-runtime-11-7
cuda-demo-suite-11-7
cuda-11-7
cuda
当我尝试sudo apt-get remove --purge nvidia-cuda-toolkit
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
答案1
尝试运行sudo dpkg --configure -a
有 3 种方法可以解决此问题:
#1 重新配置 dpkg 数据库:
sudo dpkg --configure -a
此命令重新配置已解压但未必安装的软件包。错误时间的中断可能会导致此数据库损坏。如果您正在运行安装并且该过程被中断,此命令尤其有用。
#2 强制安装软件:
sudo apt-get install -f
该-f
选项的意思是fix-broken
。它修复包管理器中任何损坏的依赖项。
#3 删除不良软件包:
sudo apt-get remove --purge package_name
该--purge
选项使系统除了卸载配置文件外,还会删除配置文件。这有助于清除有问题的软件的所有痕迹。