无法解决未满足的依赖关系

无法解决未满足的依赖关系

似乎我的软件包陷入了依赖循环,说实话我不确定。有人能帮我解决依赖问题吗?

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.7 LTS
Release:        16.04
Codename:       xenial

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:
 python3-apt : Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
               Depends: distro-info-data but it is not installed
 python3-dbus : Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
 python3-gdbm : Depends: python3 (>= 3.9.4-0~) but 3.4.0-0ubuntu2 is installed
                Depends: libgdbm6 (>= 1.16) but it is not installed
 python3-gi : Depends: gir1.2-glib-2.0 (>= 1.48.0) but 1.40.0-1ubuntu0.2 is installed
              Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
              Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.40.0-1ubuntu0.2 is installed
              Depends: libgirepository-1.0-1-with-libffi8 (>= 1.62.0-4~)
              Depends: libglib2.0-0 (>= 2.56.0) but 2.40.2-0ubuntu1.1 is installed
 python3-newt : Depends: libnewt0.52 (= 0.52.21-5+b1) but 0.52.15-2ubuntu5 is installed
                Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
 python3-pycurl : Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
                  Depends: libcurl3-gnutls (>= 7.79.1) but 7.47.0-1ubuntu2.19 is installed
 python3.9 : Depends: libpython3.9-stdlib (= 3.9.9-2) but 3.9.4-1+xenial1 is installed
 python3.9-minimal : Depends: libpython3.9-minimal (= 3.9.9-2) but 3.9.4-1+xenial1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 python3-apt : Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
               Depends: distro-info-data but it is not installed
 python3-dbus : Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
 python3-gdbm : Depends: python3 (>= 3.9.4-0~) but 3.4.0-0ubuntu2 is installed
                Depends: libgdbm6 (>= 1.16) but it is not installed
 python3-gi : Depends: gir1.2-glib-2.0 (>= 1.48.0) but 1.40.0-1ubuntu0.2 is installed
              Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
              Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.40.0-1ubuntu0.2 is installed
              Depends: libgirepository-1.0-1-with-libffi8 (>= 1.62.0-4~)
              Depends: libglib2.0-0 (>= 2.56.0) but 2.40.2-0ubuntu1.1 is installed
 python3-newt : Depends: libnewt0.52 (= 0.52.21-5+b1) but 0.52.15-2ubuntu5 is installed
                Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
 python3-pycurl : Depends: python3 (>= 3.9~) but 3.4.0-0ubuntu2 is installed
                  Depends: libcurl3-gnutls (>= 7.79.1) but 7.47.0-1ubuntu2.19 is installed
 python3.9 : Depends: libpython3.9-stdlib (= 3.9.9-2) but 3.9.4-1+xenial1 is installed
 python3.9-minimal : Depends: libpython3.9-minimal (= 3.9.9-2) but 3.9.4-1+xenial1 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

我已经花了几个小时在网上搜索来解决这个问题。如果这里不对,请见谅!

答案1

您的输出强烈表明您有错误版本(可能是错误发布)的源,并试图提供不兼容的软件包。

这种损害很容易预防,但很难修复。坦率地说,这种损害通常是由人类管理员的选择造成的。例如,从 16.04 升级窗口结束大约两年前。

如何预防:

  • 从 Ubuntu 存储库而不是上游安装软件包。
  • 永远不要更改系统提供的 Python3 版本。
  • 如果您想要闪亮的新软件,请不要将其固定在 LTS 或旧版本上。它们不是为此设计的。这只会创建一个无法维护的怪异系统。
  • 跟踪您添加到系统中的 PPA 和其他非 Ubuntu 源。当版本升级的时间到来时,卸载所有软件并禁用这些源。版本升级完成后,审核这些源以了解您真正想要重新启用的内容。
  • 不要让您的系统超出其发布的支持截止日期。这会使升级变得更加困难。

如何修复它——选项1:

  1. 卸载所有非 Ubuntu 软件。禁用所有 PPA 和非 Ubuntu 源。尽可能将系统恢复到接近出厂状态。
  2. 备份您的数据。创建 LiveUSB。如果遇到问题,请做好重新安装的准备。您的输出表明问题很可能存在。
  3. 运行 release-upgrade。仔细检查输出,检查是否由于未完全遵循步骤 #1 而导致出现问题。
  4. 由于 16.04 的版本升级将带您升级到 18.04...并且 18.04 将在几个月内(而不是几年)失去支持,因此其他发布升级至 20.04。或者可能再升级至 22.04。

如何修复它——选项2:

  1. 备份您的数据并全新安装较新版本的 Ubuntu。

相关内容