/ usr / bin / dpkg在删除和安装损坏的软件包时返回错误

我试图删除不稳定的openoffice并重新安装libreoffice然而我在清除它之前意外删除了/opt下的openoffice目录。 现在我无法清理损坏的包,也无法删除/安装libreofficeapt-get -f install不能用于错误:

 .... Errors were encountered while processing: /var/cache/apt/archives/libreoffice-common_1%3a4.2.7-0ubuntu2_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 

我按照如何通过dpkg手动删除包来修复损坏的包 ,但它没有将其删除干净。 同样的问题仍然存在。

我有无法满足的依赖关系,我无法清理或向上移动:

 dpkg: error processing package libreoffice-calc (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: libreoffice-java-common libreoffice-sdbc-hsqldb libreoffice-core python3-uno libreoffice-math libreoffice-impress libreoffice-writer libreoffice-base-core libreoffice-gnome libreoffice-base libreoffice-sdbc-firebird libreoffice-report-builder-bin libreoffice-pdfimport libreoffice-avmedia-backend-gstreamer libreoffice-gtk libreoffice-base-drivers libreoffice-draw libreoffice-calc 

基本上它们依赖于一个名为libreoffice-common的包,但我不知道如何清除或安装它。


更新:

遵循mchid和sudo apt-get install ... (实际上他们做了与apt-get install libreoffice相同的事情)终止于:

 Selecting previously unselected package xfonts-mathml. Preparing to unpack .../xfonts-mathml_6ubuntu1_all.deb ... Unpacking xfonts-mathml (6ubuntu1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for shared-mime-info (1.2-0ubuntu3) ... 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 mime-support (3.54ubuntu1.1) ... Processing triggers for hicolor-icon-theme (0.13-1) ... Processing triggers for gnome-icon-theme (3.10.0-0ubuntu2) ... Processing triggers for fontconfig (2.11.0-0ubuntu4.1) ... Errors were encountered while processing: /var/cache/apt/archives/libreoffice-common_1%3a4.2.7-0ubuntu2_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 

我现在所知道的是,似乎我用libreofficeopenoffice清除了所有内容。 使用命令:

 sudo apt-get purge libreoffice* sudo apt-get purge openoffice* sudo apt-get autoremove sudo apt-get clean sudo dpkg --configure -a #double check, reports nothing sudo dpkg -L libreoffice sudo dpkg -L openoffice 

所有这些都显示它们已被彻底删除,但是,我只是无法安装libreoffice ,只有一行/usr/bin/dpkg returned an error code (1)

假设你正在运行常规的ubuntu而不是ubuntu-gnome ,请运行以下命令来解决问题:

 sudo apt-get update sudo apt-get purge openoffice* libreoffice* python3-uno sudo apt-get install libreoffice-java-common libreoffice-sdbc-hsqldb libreoffice-core python3-uno libreoffice-math libreoffice-impress libreoffice-writer libreoffice-base-core libreoffice-gnome libreoffice-base libreoffice-sdbc-firebird libreoffice-report-builder-bin libreoffice-pdfimport libreoffice-avmedia-backend-gstreamer libreoffice-gtk libreoffice-base-drivers libreoffice-draw libreoffice-calc 

首先感谢@mchid ,试图提供帮助。 然而,在这种情况下,我必须删除openoffice干净,遗憾的是它已经破碎,因此没有办法以正常方式清除它。

如何使这项工作? 首先修复破损的包裹。 所以:

  • 步骤1.检查是否有任何包破损。

     sudo dpkg -l | grep openoffice # check if any packages remained, and what are they sudo dpkg -l | grep libreoffice 

由于我确实有不清楚的包删除,我必须清除它:

  • 第2步。准备安装。

     sudo apt-get purge openoffice* libreoffice* 

重复步骤1和2,直到dpkg -l | grep office dpkg -l | grep office命令不再报告。 那应该是干净的。

  • 第3步。再次安装。

我们可以向上移动修复openoffice,(不能通过步骤1和2清除)以下内容: 在linux上安装openoffice的官方指南,以及互联网上的大量说明。

  • 步骤4.清洗干净。

完成后,运行: sudo apt-get -f install 。 应该没有任何问题。 我们可以再次删除包,因为我们现在正在使apt-get正常工作:

 sudo apt-get purge openoffice* sudo dpkg -l | grep openoffice # shouldn't report anything, since we cleanly removed it 
  • 步骤5.安装libreoffice。

我们可以再次安装libreoffice:

 sudo apt-get install libreoffice 

最后我的libreoffice工作了。