我从 16.04 升级到 18.04 时出现此错误

我从 16.04 升级到 18.04 时出现此错误
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 dh-python : Depends: python3-distutils but it is not installed
 libnautilus-extension1a : Depends: libglib2.0-0 (>= 2.51.2) but 2.48.2-0ubuntu4.3 is installed
 onboard : Depends: onboard-common (< 1.4.1-2ubuntu1.1) but it is not installed
           Depends: onboard-common (>= 1.4.1-2ubuntu1) but it is not installed
           Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
           Depends: libhunspell-1.6-0 but it is not installed
           Recommends: onboard-data (>= 1.4.1-2ubuntu1) but 1.2.0-0ubuntu5 is installed
 python-apt : Depends: libapt-inst2.0 (>= 1.6.5~) but 1.2.32 is installed
              Depends: libapt-pkg5.0 (>= 1.6.5~) but 1.2.32 is installed
 python3-apt : Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
               Depends: libapt-inst2.0 (>= 1.6.5~) but 1.2.32 is installed
               Depends: libapt-pkg5.0 (>= 1.6.5~) but 1.2.32 is installed
 python3-cairo : Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
 python3-dbus.mainloop.qt : Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
 python3-gdbm : Depends: python3 (>= 3.6.6-1~) but 3.5.1-3 is installed
                Depends: libgdbm5 (>= 1.14) but it is not installed
 python3-pyqt4 : Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
 python3-reportlab-accel : Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
 python3-sip : Depends: python3 (>= 3.6~) but 3.5.1-3 is installed
 rhythmbox : Depends: rhythmbox-data (= 3.3-1ubuntu7) but 3.4.2-4ubuntu1 is installed
 ubuntu-session : Depends: gnome-settings-daemon (>= 3.23.3) but 3.18.2-0ubuntu3.1 is installed
                  Depends: gnome-shell (>= 3.24.3-0ubuntu2) but 3.18.5-0ubuntu0.3 is installed
                  Depends: gnome-session-bin (>= 3.28.1-0ubuntu3) but 3.18.1.2-1ubuntu1.16.04.2 is installed
                  Depends: gnome-session-common (= 3.28.1-0ubuntu3) but 3.18.1.2-1ubuntu1.16.04.2 is installed
                  Depends: xwayland
                  Recommends: gnome-themes-extra but it is not installed
 unity : Depends: libgnome-desktop-3-17 (>= 3.17.92) but it is not installed
         Depends: libgtk-3-0 (>= 3.19.12) but 3.18.9-1ubuntu3.3 is installed
         Depends: libsigc++-2.0-0v5 (>= 2.8.0) but 2.6.2-1 is installed
         Depends: libunity-core-6.0-9 (= 7.5.0+18.04.20190304-0ubuntu1) but 7.4.5+16.04.20190312-0ubuntu1 is installed
         Depends: libunity-protocol-private0 (>= 7.1.4+18.04.20180209.1) but 7.1.4+16.04.20180209.1-0ubuntu1 is installed
         Depends: gsettings-ubuntu-schemas (>= 0.0.7+17.10.20170922) but 0.0.5+16.04.20160307-0ubuntu1 is installed
         Recommends: hud but it is not installed
         Recommends: unity-session but it is not installed
 unity-settings-daemon : Depends: libfcitx-gclient1 (>= 1:4.2.9.5) but it is not installed
                         Depends: libgnome-desktop-3-17 (>= 3.17.92) but it is not installed
                         Depends: gsettings-ubuntu-schemas (>= 0.0.7+17.10.20170922) but 0.0.5+16.04.20160307-0ubuntu1 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

答案1

昨天我在测试 16.04 到 18.04 升级时也遇到了同样的错误。这是 Ubuntu 16.04.6 LTS 的一个相对简单的安装。最后出现了一个总结:

Errors were encountered while processing:
 unity-settings-daemon
 rhythmbox-plugin-zeitgeist
 unity
 gnome-icon-theme
 ubuntu-session
 hud
 libnautilus-extension1a:amd64
 python3-gdbm:amd64
 python3-reportlab-accel:amd64
 python3-cairo:amd64
 dh-python
 nautilus
 onboard
 python3-renderpm:amd64
 totem-plugins
 unity-tweak-tool

Upgrade complete 

解决方案是运行sudo apt install -f 两次。第一次修复了一些错误,第二次修复了其余的错误。

可能与今天早上有关,我修复了升级过程中发现的一个错误,并在实时 16.04.6 系统上运行了答案:

笔记:还有其他问题,因此我可能会使用此脚本在克隆上再次运行升级:

我鼓励每个人都在 Ubuntu 克隆上运行升级以解决所有错误。

相关内容