我正在升级我的发行版。但在升级过程中,我遇到了这样的包失败错误。我尝试了所有方法,但找不到任何解决方案。你有什么建议吗?
$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
blueman : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
Depends: gir1.2-ayatanaappindicator3-0.1 but it is not installed
dbus-user-session : Depends: dbus (>= 1.12.20-1ubuntu3)
dbus-x11 : Depends: libdbus-1-3 (= 1.12.20-1ubuntu3) but 1.12.16-2ubuntu2.1 is installed
gir1.2-gtk-3.0 : Depends: libgtk-3-0 (>= 3.24.24) but 3.24.20-0ubuntu1 is installed
gnupg : Depends: gpgv (>= 2.2.20-1ubuntu3)
gpgsm : Depends: libksba8 (>= 1.5.0) but 1.3.5-2 is installed
libpython3-dev : Depends: libpython3.9-dev (>= 3.9.4-0~) but it is not installed
lz4 : Depends: liblz4-1 (= 1.9.2-2) but 1.9.3-1build1 is installed
onboard : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
Recommends: gir1.2-ayatanaappindicator3-0.1 but it is not installed
python3-apt : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-dev : Depends: libpython3-dev (= 3.8.2-0ubuntu2) but 3.9.4-1 is installed
python3-gi : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-gi-cairo : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-markupsafe : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-netifaces : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-pil : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-protobuf : Depends: libprotobuf23 (>= 3.12.4) but it is not installed
Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-psutil : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-renderpm : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-reportlab-accel : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-simplejson : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-systemd : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
python3-talloc : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
Depends: libpython3.9 (>= 3.9.1) but it is not installed
python3-uno : Depends: libreoffice-common (>= 1:7.0.0~alpha~) but 1:6.4.7-0ubuntu0.20.04.1 is installed
Depends: libreoffice-core (= 1:7.1.3-0ubuntu0.21.04.1) but 1:6.4.7-0ubuntu0.20.04.1 is installed or
libreoffice-core-nogui (= 1:7.1.3-0ubuntu0.21.04.1) but it is not installed
Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
Depends: python3.9 but it is not installed
Depends: libpython3.9 (>= 3.9.1) but it is not installed
python3-venv : Depends: python3.9-venv (>= 3.9.4-0~) but it is not installed
Depends: python3 (= 3.9.4-1) but 3.8.2-0ubuntu2 is installed
Depends: python3-distutils (>= 3.9.4-0~) but 3.8.5-1~20.04.1 is installed
python3-yaml : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
rhythmbox-plugins : Depends: libimobiledevice6 (>= 1.3.0) but 1.2.1~git20191129.9f79242-1build1 is installed
Depends: librhythmbox-core10 (= 3.4.4-1ubuntu4) but 3.4.4-1ubuntu2 is installed
Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
Depends: python3.9 but it is not installed
Depends: rhythmbox (= 3.4.4-1ubuntu4) but 3.4.4-1ubuntu2 is installed
Depends: gir1.2-rb-3.0 (= 3.4.4-1ubuntu4) but 3.4.4-1ubuntu2 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).enter code here
答案1
修复当前安装的系统上的软件包
sudo apt --fix-broken install
sudo apt-get update
sudo apt-get install aptitude
sudo aptitude safe-upgrade
sudo aptitude upgrade
sudo aptitude dist-upgrade
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt --fix-broken install
sudo dpkg --configure -a
如果你确实想升级到非 LTS 9 个月的支持版本(比如说有很多不必要的升级到下一个 LTS,如:20.04 LTS → 20.10 → 21.04 →21.10→22.04 长期支持),然后允许此类升级过程并使用支持的正确方法运行它
sudo rm /etc/apt/preferences.d/pin-focal
sudo sed -i "s/^Prompt=lts/Prompt=normal/" /etc/update-manager/release-upgrades
sudo sed -i "s/^Prompt=never/Prompt=normal/" /etc/update-manager/release-upgrades
update-manager -c # in GUI or
# sudo do-release-upgrade # in terminal
注意:最后一个命令应该运行两次 - 第一次针对 20.04 LTS → 20.10,第二次针对 20.10 → 21.04。对于后者,您可能需要提供额外的-d
选项。