Ubuntu 18升级至20后出现依赖问题,无法执行安装/清理/升级操作求助
Ubuntu 18升级至20后出现依赖问题,无法执行安装/清理/升级操作求助
我尝试把Ubuntu 18升级到20版本,升级流程显示完成了,但实际上系统并没有完全升级——旧的GUI还在,备份、更新、设置窗口这些都打不开。之后我试着执行apt update和apt upgrade,结果一直碰到未满足依赖的错误,具体错误信息如下:
The following packages have unmet dependencies: account-plugin-tools : Depends: python3-gi but it is not going to be installed appmenu-qt : Depends: libqtcore4 (>= 4:4.8) but it is not installable apport : Depends: python3-gi but it is not going to be installed apport-gtk : Depends: python3-gi but it is not going to be installed aptdaemon : Depends: python3-gi but it is not going to be installed apturl : Depends: python3-gi but it is not going to be installed compiz-gnome : Depends: python3-gi but it is not going to be installed gedit : Depends: python3-gi (>= 3.0) but it is not going to be installed gnome-terminal : Depends: python3-gi but it is not going to be installed hplip : Depends: python3-gi but it is not going to be installed ibus : Depends: python3-gi but it is not going to be installed language-selector-gnome : Depends: python3-gi but it is not going to be installed libdbusmenu-qt2 : Depends: libqtcore4 (>= 4:4.7.0~beta1) but it is not installable libnss-systemd : Depends: systemd (= 237-3ubuntu10.57) libpam-systemd : Depends: systemd (= 237-3ubuntu10.57) libqt4-declarative : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-designer : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-help : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-network : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-script : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-scripttools : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-sql : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-sql-sqlite : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-svg : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-test : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-xml : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqt4-xmlpatterns : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqtassistantclient4 : Depends: libqtcore4 (>= 4:4.8.1) but it is not installable libqtdbus4 : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libqtgui4 : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable libreoffice-common : Breaks: libreoffice-style-galaxy (>= 1:6.1~) but 1:6.4.7-0ubuntu0.20.04.8 is to be installed Breaks: libreoffice-style-tango (>= 1:6.1~) but 1:6.4.7-0ubuntu0.20.04.8 is to be installed libsmbclient : Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed meld : Depends: python3-gi (>= 3.14) but it is not going to be installed networkd-dispatcher : Depends: python3-gi but it is not going to be installed onboard : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed orca : Depends: python3-gi (>= 3.18) but it is not going to be installed pyqt4-dev-tools : Depends: libqtcore4 (>= 4:4.8.0-1~) but it is not installable python-qt4 : Depends: libqtcore4 (>= 4:4.8.0-1~) but it is not installable python-qt4-dbus : Depends: libqtcore4 (>= 4:4.8.0-1~) but it is not installable python-samba : Depends: python-tdb but it is not installable Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed python3 : PreDepends: python3-minimal (= 3.6.7-1~18.04) but 3.8.2-0ubuntu2 is to be installed Depends: libpython3-stdlib (= 3.6.7-1~18.04) but 3.8.2-0ubuntu2 is to be installed python3-all : Depends: python3 (= 3.8.2-0ubuntu2) but 3.6.7-1~18.04 is to be installed python3-all-dev : Depends: python3 (= 3.8.2-0ubuntu2) but 3.6.7-1~18.04 is to be installed python3-aptdaemon : Depends: python3-gi but it is not going to be installed python3-aptdaemon.gtk3widgets : Depends: python3-gi but it is not going to be installed python3-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-click-package : Depends: python3-gi but it is not going to be installed python3-dbus.mainloop.pyqt5 : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-dev : Depends: python3 (= 3.8.2-0ubuntu2) but 3.6.7-1~18.04 is to be installed python3-distutils : Depends: python3:any (>= 3.8.2-0~) python3-gi-cairo : Depends: python3-gi (= 3.26.1-2ubuntu1) but it is not going to be installed python3-lib2to3 : Depends: python3:any (>= 3.8.2-0~) python3-oneconf : Depends: python3-gi but it is not going to be installed python3-pyatspi : Depends: python3-gi (>= 2.90.1) but it is not going to be installed python3-pyqt4 : Depends: libqtcore4 (>= 4:4.8.0-1~) but it is not installable python3-pyqt5 : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-pyqt5.qtmultimedia : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-pyqt5.qtopengl : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-pyqt5.qtsvg : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-pyqt5.qtwebkit : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-renderpm : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-reportlab-accel : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-sip : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed python3-software-properties : Depends: python3-gi but it is not going to be installed python3-systemd : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed qdbus : Depends: libqtcore4 (= 4:4.8.7+dfsg-7ubuntu1) but it is not installable qt-at-spi : Depends: libqtcore4 (>= 4:4.8~) but it is not installable rhythmbox-plugin-alternative-toolbar : Depends: python3-gi but it is not going to be installed rhythmbox-plugins : Depends: python3-gi but it is not going to be installed samba : Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed samba-common-bin : Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed samba-dsdb-modules : Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed Depends: libwbclient0 (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed samba-libs : Depends: libldb2 (>= 2:2.4.4-0ubuntu0.20.04.2) but it is not going to be installed Depends: python3-ldb (>= 2:2.1.0) but it is not going to be installed Depends: python3-talloc (>= 2.3.1~) but it is not going to be installed samba-vfs-modules : Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed smbclient : Depends: samba-libs (= 2:4.7.6+dfsg~ubuntu-0ubuntu2.29) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed software-center-aptdaemon-plugins : Depends: python3-gi but it is not going to be installed software-properties-common : Depends: python3-gi but it is not going to be installed software-properties-gtk : Depends: python3-gi but it is not going to be installed system-config-printer : Depends: python3-gi but it is not going to be installed system-config-printer-common : Depends: python3-gi but it is not going to be installed system-image-common : Depends: python3-gi but it is not going to be installed systemd : Depends: libsystemd0 (= 245.4-4ubuntu3.22) but 237-3ubuntu10.57 is to be installed totem-plugins : Depends: python3-gi (>= 2.90.3) but it is not going to be installed ubuntu-release-upgrader-gtk : Depends: python3-gi (>= 3.8) but it is not going to be installed ubuntu-system-service : Depends: python3-gi but it is not going to be installed unattended-upgrades : Depends: python3-gi but it is not going to be installed unity : Depends: python3-gi but it is not going to be installed unity-scope-calculator : Depends: python3-gi but it is not going to be installed unity-scope-chromiumbookmarks : Depends: python3-gi but it is not going to be installed unity-scope-colourlovers : Depends: python3-gi but it is not going to be installed unity-scope-devhelp : Depends: python3-gi but it is not going to be installed unity-scope-firefoxbookmarks : Depends: python3-gi but it is not going to be installed unity-scope-manpages : Depends: python3-gi but it is not going to be installed unity-scope-openclipart : Depends: python3-gi but it is not going to be installed unity-scope-texdoc : Depends: python3-gi but it is not going to be installed unity-scope-tomboy : Depends: python3-gi but it is not going to be installed unity-scope-virtualbox : Depends: python3-gi but it is not going to be installed unity-scope-yelp : Depends: python3-gi but it is not going to be installed unity-scope-zotero : Depends: python3-gi but it is not going to be installed update-manager : Depends: python3-gi (>= 3.8) but it is not going to be installed usb-creator-gtk : Depends: python3-gi but it is not going to be installed xdiagnose : Depends: python3-gi (>= 3.2.0-3) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我已经试过以下方法,但都没解决问题:
- 启用更新源里的"universe"组件
- 使用Aptitude工具
- 清理(purge)相关包
- 执行
sudo apt configure -a - 按照提示执行
sudo apt --fix-broken install,但还是弹出同样的依赖错误
针对这个问题的解决方案建议
从错误日志来看,核心问题是升级过程中核心包版本不匹配(比如Python3从3.6升到3.8失败、Systemd版本冲突),加上Ubuntu 20.04不再支持的Qt4旧包残留导致依赖链断裂。可以按以下步骤逐步修复:
1. 先修复包管理器的基础状态
首先执行一系列命令清理并重新配置包系统:
sudo apt clean sudo apt autoclean sudo dpkg --configure -a sudo apt-get -f install
2. 强制修复核心版本冲突的包
针对Python3和Systemd这两个最关键的冲突点,强制安装Ubuntu 20.04对应的版本:
# 修复Python3版本 sudo apt-get install --fix-missing python3=3.8.2-0ubuntu2 python3-minimal=3.8.2-0ubuntu2 libpython3-stdlib=3.8.2-0ubuntu2 # 修复Systemd版本 sudo apt-get install --fix-missing systemd=245.4-4ubuntu3.22 libsystemd0=245.4-4ubuntu3.22
3. 移除Qt4相关的过时包
Ubuntu 20.04已经放弃对Qt4的支持,这些包是依赖错误的重灾区,彻底移除它们:
sudo apt-get purge libqtcore4 libqtgui4 appmenu-qt python-qt4 python3-pyqt4 qdbus qt-at
相关产品推荐
相关产品推荐

