Ubuntu 20.04 最近的更新彻底破坏了 LibreOffice,我尝试了论坛上找到的所有方法来删除损坏的软件包,但都无济于事。
"Unable to correct problems, you have held broken packages."
请帮忙!
我在家工作,确实需要使用 LibreOffice。谢谢。
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libreoffice : Depends: libreoffice-base but it is not going to be installed
Depends: libreoffice-calc but it is not going to be installed
Depends: libreoffice-core (= 1:7.3.0~rc3-0ubuntu0.20.04.1~lo1) but it is not going to be installed
Depends: libreoffice-draw but it is not going to be installed
Depends: libreoffice-impress but it is not going to be installed
Depends: libreoffice-math but it is not going to be installed
Depends: libreoffice-report-builder-bin but it is not going to be installed
Depends: libreoffice-writer but it is not going to be installed
Depends: python3-uno (>= 4.4.0~beta2) but it is not going to be installed
Recommends: libreoffice-gnome but it is not going to be installed or
libreoffice-plasma but it is not going to be installed
Recommends: libreoffice-nlpsolver but it is not going to be installed
Recommends: libreoffice-report-builder but it is not going to be installed
Recommends: libreoffice-script-provider-bsh but it is not going to be installed
Recommends: libreoffice-script-provider-js but it is not going to be installed
Recommends: libreoffice-script-provider-python but it is not going to be installed
Recommends: libreoffice-sdbc-mysql but it is not going to be installed
Recommends: libreoffice-sdbc-postgresql but it is not going to be installed
Recommends: libreoffice-wiki-publisher but it is not going to be installed
Recommends: libreoffice-java-common (>= 1:7.3.0~rc3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
以下是 apt policy libreoffice 的输出
Installed: (none)
Candidate: 1:7.3.0~rc3-0ubuntu0.20.04.1~lo1
Version table:
1:7.3.0~rc3-0ubuntu0.20.04.1~lo1 500
500 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal/main amd64 Packages
1:7.1.7-0ubuntu0.21.04.1~bpo20.04.1 100
100 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages
1:6.4.7-0ubuntu0.20.04.2 500
500 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
500 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages
1:6.4.2-0ubuntu3 500
500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
ppa-purge 之后的最新错误:
sudo apt-get install libreoffice
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libreoffice : Depends: libreoffice-base but it is not going to be installed
Depends: libreoffice-calc but it is not installable
Depends: libreoffice-core (= 1:6.4.7-0ubuntu0.20.04.2) but it is not installable
Depends: libreoffice-draw but it is not installable
Depends: libreoffice-impress but it is not installable
Depends: libreoffice-math but it is not installable
Depends: libreoffice-report-builder-bin but it is not going to be installed
Depends: libreoffice-writer but it is not installable
Depends: python3-uno (>= 4.4.0~beta2) but it is not installable
Recommends: libreoffice-gnome but it is not installable or
libreoffice-plasma but it is not going to be installed
Recommends: libreoffice-nlpsolver but it is not installable
Recommends: libreoffice-report-builder but it is not going to be installed
Recommends: libreoffice-script-provider-bsh but it is not going to be installed
Recommends: libreoffice-script-provider-js but it is not going to be installed
Recommends: libreoffice-script-provider-python but it is not going to be installed
Recommends: libreoffice-sdbc-mysql but it is not going to be installed
Recommends: libreoffice-sdbc-postgresql but it is not going to be installed
Recommends: libreoffice-wiki-publisher but it is not going to be installed
Recommends: libreoffice-java-common (>= 1:6.4.7~) but it is not installable
E: Unable to correct problems, you have held broken packages.
apt update 的输出 sudo apt update
Get:1 file:/var/cuda-repo-ubuntu2004-11-3-local InRelease
Ign:1 file:/var/cuda-repo-ubuntu2004-11-3-local InRelease
Get:2 file:/var/cuda-repo-ubuntu2004-11-3-local Release [564 B]
Get:2 file:/var/cuda-repo-ubuntu2004-11-3-local Release [564 B]
Hit:4 https://repo.skype.com/deb stable InRelease
Hit:5 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:6 https://packages.microsoft.com/repos/code stable InRelease
Hit:7 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:8 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:9 http://repository.spotify.com stable InRelease
Hit:10 https://cli.github.com/packages stable InRelease
Get:11 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Fetched 336 kB in 11s (29,6 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
答案1
部分答案——诊断,而不是修复
在 20.04 虚拟机中,我通过添加以下代码启用了 universe backport repo:
deb http://archive.ubuntu.com/ubuntu focal-backports universe
到/etc/apt/sources.list
这给出了apt policy libreoffice
输出
libreoffice:
Installed: 1:6.4.7-0ubuntu0.20.04.2
Candidate: 1:6.4.7-0ubuntu0.20.04.2
Version table:
1:7.1.7-0ubuntu0.21.04.1~bpo20.04.1 100
100 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages
*** 1:6.4.7-0ubuntu0.20.04.2 500
500 ssh://st8/media/ST8-Photos/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
500 ssh://st8/media/ST8-Photos/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages
100 /var/lib/dpkg/status
1:6.4.2-0ubuntu3 500
500 ssh://st8/media/ST8-Photos/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
尝试安装 libreoffice 时
Selected version '1:7.1.7-0ubuntu0.21.04.1~bpo20.04.1' (Ubuntu:20.04/focal-backports [amd64]) for 'libreoffice'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libreoffice : Depends: libreoffice-core (= 1:7.1.7-0ubuntu0.21.04.1~bpo20.04.1) but 1:6.4.7-0ubuntu0.20.04.2 is to be installed
Recommends: libreoffice-java-common (>= 1:7.1.7~) but 1:6.4.7-0ubuntu0.20.04.2 is to be installed
E: Unable to correct problems, you have held broken packages.
从一个新的虚拟机开始,我能够毫无困难地从问题中给出的 ppa 安装 libreoffice。
所以我相信问题出在 backports 存储库中。我不确定如何从您的系统中删除它,因为您可能从中安装了其他软件。
答案2
问题的核心是您尝试混合来自两个不同来源(PPA 和 Backports)的 deb 包,但这两个来源都提供相同的软件。
不要这样做。这些软件包不兼容。您(人类)必须决定使用哪个来源,而不要让系统做出选择。
如果是我的系统,我会清除所有 LibreOffice 软件包并重新开始。
apt-mark showmanual | grep libreoffice
获取必须的 libreoffice 软件包列表指定的以便移除。sudo apt remove package1 package2 package3 packageN
删除这些包。sudo apt autoremove
删除新孤立的依赖项。
现在您可以重新安装干净的 LibreOffice。您有多种选择。
- 6.4.7 来自焦点更新
- 7.1.7 来自 focal-backports
- 来自 PPA 的 7.3.0
- 7.2.5 来自 snap 版本(稳定版)
- 7.3.0 来自 snap(测试版)
选择一个来源并坚持使用它。禁用其他来源。不要尝试混合来源。
如果您更改来源,请准备完全卸载 LibreOffice 并从新来源重新安装。