处理 libreoffice-common 时遇到错误

处理 libreoffice-common 时遇到错误

我尝试使用“sudo apt-get -f install”,也尝试使用“sudo apt-get install -f”来修复依赖项,但没有成功。这也阻止我安装 Synaptic 来删除 libreoffice 并修复问题。我同时拥有 Openoffice 和 Libreoffice

miguel@Miguel:~$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libreoffice-common
Suggested packages:
libreoffice-style-crystal libreoffice-style-hicontrast
libreoffice-style-oxygen libreoffice-style-sifr
The following NEW packages will be installed:
libreoffice-common
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
15 not fully installed or removed.
Need to get 0 B/20.3 MB of archives.
After this operation, 79.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 263460 files and directories currently installed.)
Preparing to unpack .../libreoffice-common_1%3a4.4.1~rc2-0ubuntu1~trusty1_all.deb   ...
Unpacking libreoffice-common (1:4.4.1~rc2-0ubuntu1~trusty1) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-   common_1%3a4.4.1~rc2-0ubuntu1~trusty1_all.deb (--unpack):
trying to overwrite '/usr/bin/soffice', which is also in package openoffice-  debian-menus 4.1-9764
rmdir: failed to remove ‘/var/lib/libreoffice/share/prereg/’: No such file or directory
rmdir: failed to remove ‘/var/lib/libreoffice/share/’: No such file or directory
rmdir: failed to remove ‘/var/lib/libreoffice/program/’: No such file or directory
rmdir: failed to remove ‘/var/lib/libreoffice’: No such file or directory
rmdir: failed to remove ‘/var/lib/libreoffice’: No such file or directory
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for gnome-icon-theme (3.10.0-0ubuntu2) ...
Errors were encountered while processing:
/var/cache/apt/archives/libreoffice-common_1%3a4.4.1~rc2-0ubuntu1~trusty1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)`

答案1

我发现这是一个已确认的错误

如果您正在运行防病毒软件...例如 sophos,您需要禁用按需扫描程序,然后更新您的系统,然后重新启用按需扫描程序。

https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1454668

答案2

问题的关键就在错误信息的顶部附近:

dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a4.4.1~rc2-0ubuntu1~trusty1_all.deb (--unpack):
 trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1-9764

让我们稍微抽象一下这个错误消息,以使其更具可读性:

dpkg: error processing archive PACKAGE_NAME_A.deb (--unpack):
 trying to overwrite 'FILE', which is also in PACKAGE_B

解释:除了少数例外,每个文件只能由一个包提供。当两个包提供同一个文件时,这两个包冲突,这会导致出现错误消息。

解决错误的方法是卸载 PACKAGE_A(libreoffice-common)或 PACKAGE_B(openoffice-debian-menus)。

请注意,这个问题不是一个错误 - 是人为混合了 PPA 和 Debian 中不兼容的软件包而导致的。坚持使用 Ubuntu 存储库(或 Snap)的用户不会遇到此问题。

答案3

  1. gksudo 鹦鹉螺
  2. 删除文件夹 /var/cache/apt/ 中的所有内容
  3. 将 ppa 转为 Libreoffice
  4. 运行 sudo apt-get -f install

这对我有用,最初发布于libreoffice 更新问题,我只是添加了一些内容来澄清一下。

相关内容