子进程 /usr/bin/dpkg 返回错误代码 (1)

子进程 /usr/bin/dpkg 返回错误代码 (1)

我知道这是一条通用错误消息,但我无法解读发生了什么 - 为什么 Apache 不想更新?

(Reading database ... 50302 files and directories currently installed.)
Unpacking apache2-bin (from .../apache2-bin_2.4.16-4+deb.sury.org~precise+4_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_i386.deb (--unpack):
 trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.8
dpkg-deb (subprocess): subprocess data was killed by signal (Broken pipe)
dpkg-deb: error: subprocess <decompress> returned error exit status 2
Preparing to replace e2fslibs 1.42-1ubuntu2.2 (using .../e2fslibs_1.42-1ubuntu2.3_i386.deb) ...
Unpacking replacement e2fslibs ...
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

真正的错误是:

“试图覆盖'/usr/share/man/man8/apache2.8.gz',它也在包apache2.2-common 2.2.22-1ubuntu1.8中”

看起来某些第三方存储库中的软件包与 ubuntu 本身的软件包之间存在文件冲突。鉴于这只是一个联机帮助页,我建议强制安装。

dpkg -i --force-overwrite /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_i386.deb

答案2

默认情况下,dpkg不会覆盖属于另一个包的文件 - 并且当包被重命名或包的集合被重组时,特定包的文件“所有权”可能会发生变化。

您需要apt-get使用-o Dpkg::Options::="--force-overwrite"如下选项运行:

apt-get -o Dpkg::Options::="--force-overwrite" ...

/etc/apt/apt.conf或者您可以通过将其添加到文件或文件中来使其永久化,/etc/apt/apt.conf.d/如下所示:

DPkg { Options {"--force-overwrite";} };

相关内容