未满足的依赖关系会阻止程序安装或更新;删除罪魁祸首包不起作用

未满足的依赖关系会阻止程序安装或更新;删除罪魁祸首包不起作用

出于好奇(我不记得具体原因,我读的指南中使用的一些程序没有安装,我按照 CL 说明下载了哪些软件包),我尝试在运行 Ubuntu 23.10.1 的笔记本电脑上安装 linux-tools。由于一些未满足的依赖关系,该软件包未正确安装,也无法删除:

$ sudo apt purge linux-tools-6.5.0-26
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:
 linux-tools-6.5.0-26-generic : Depends: linux-tools-6.5.0-26 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

sudo apt --fix-broken install返回类似的错误:

$ sudo 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:
  hwdata libbotan-2-19 libminizip1 libqt5concurrent5 libqt5x11extras5 libtspi1 libzxcvbn0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-tools-common
The following NEW packages will be installed:
  linux-tools-common
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/450 kB of archives.
After this operation, 548 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 405820 files and directories currently installed.)
Preparing to unpack .../linux-tools-common_6.5.0-9.9_all.deb ...
Unpacking linux-tools-common (6.5.0-9.9) ...
dpkg: error processing archive /var/cache/apt/archives/linux-tools-common_6.5.0-9.9_all.deb (--unpack):
 trying to overwrite '/usr/bin/cpupower', which is also in package linux-laptop-tools-common 6.5.0-1006.9
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-tools-common_6.5.0-9.9_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt upgrade由于同样的错误(未满足的依赖项),我无法运行。sudo dpkg --configure -a也不起作用,以及sudo apt removesudo apt autoremove我还尝试了(使用我再也找不到的 Ask Ubuntu 答案)以下内容:

sudo mv /etc/apt/sources.list ~/
sudo touch /etc/apt/sources.list
software-properties-gtk

然后勾选允许下载更新的复选框。这也不起作用。当尝试安装软件包(在本例中是电子阅读器,我还遇到了依赖性问题):


sudo apt install okular
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:
 linux-tools-6.5.0-26 : Depends: linux-tools-common but it is not going to be installed
 okular : Depends: kinit but it is not going to be installed
          Depends: kio but it is not going to be installed
          Depends: libkf5activities5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5archive5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5bookmarks5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5codecs5 (>= 4.96.0) but it is not going to be installed
          Depends: libkf5completion5 (>= 5.81.0) but it is not going to be installed
          Depends: libkf5configcore5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5configgui5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5configwidgets5 (>= 5.81.0) but it is not going to be installed
          Depends: libkf5coreaddons5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5crash5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5i18n5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5itemviews5 (>= 4.96.0) but it is not going to be installed
          Depends: libkf5jobwidgets5 (>= 4.96.0) but it is not going to be installed
          Depends: libkf5kexiv2-15.0.0 (>= 23.08.1~) but it is not going to be installed
          Depends: libkf5kiocore5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5kiogui5 (>= 5.69.0) but it is not going to be installed
          Depends: libkf5kiowidgets5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5parts5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5pty5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5purpose-bin but it is not going to be installed
          Depends: libkf5purpose5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5textwidgets5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5wallet-bin but it is not going to be installed
          Depends: libkf5wallet5 (>= 5.68.0~) but it is not going to be installed
          Depends: libkf5widgetsaddons5 (>= 5.77.0) but it is not going to be installed
          Depends: libkf5windowsystem5 (>= 5.89.0) but it is not going to be installed
          Depends: libkf5xmlgui5 (>= 5.79.0) but it is not going to be installed
          Depends: libokular5core11 (= 4:23.08.1-0ubuntu1) but it is not going to be installed
          Depends: libphonon4qt5-4 (>= 4:4.8.0) but it is not going to be installed
          Depends: libqmobipocket2 (>= 4:23.08.1~) but it is not going to be installed
          Depends: libqt5texttospeech5 (>= 5.12.0~) but it is not going to be installed
          Depends: phonon4qt5 but it is not going to be installed
          Recommends: okular-extra-backends but it is not going to be installed
          Recommends: qtspeech5-flite-plugin but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

另外,关于类似的问题描述这里,我肯定有足够的 RAM(据我所知是 16 GB)。 sudo apt clean并且sudo apt autoclean(建议这里) 不能解决问题。 允许使用受限和宇宙源。sudo apt install -f没有帮助。sudo apt -u dist-upgrade引发相同的错误。

更新: 来自的建议这里至少部分地帮助了我:

sudo apt --fix-broken install -o Dpkg::Options::="--force-overwrite"

目前看来这可以解决问题,但我不确定它是否不会在将来引起任何问题。

相关内容