dpkg-divert:错误:从16.04升级到16.10后,重命名涉及覆盖错误


44

将Ubuntu 16.04升级到16.10后出现一个奇怪的错误。

软件更新程序建议进行部分更新:

无法安装“ systemd-shim”

升级将继续,但是'systemd-shim'软件包可能未处于工作状态。请考虑提交有关此问题的错误报告。

subprocess installed post-removal script returned error exit status 2

sudo apt-get update 完成没有任何错误。

sudo apt-get remove 输出这个

The following packages will be REMOVED:
  systemd-shim
0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade.
1 not fully installed or removed.
After this operation, 71.7 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 1451244 files and directories currently installed.)
Removing systemd-shim (9-1bzr4ubuntu1) ...
Removing 'diversion of /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service to /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd by systemd-shim'
dpkg-divert: error: rename involves overwriting '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service' with
  different file '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd', not allowed
dpkg: error processing package systemd-shim (--remove):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
 systemd-shim
E: Sub-process /usr/bin/dpkg returned an error code (1)

请帮助我解决此错误。谢谢。

Answers:


82
  1. 在终端上,重命名/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.bak

    sudo mv /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.bak
    
  2. 继续运行sudo apt upgrade

希望不再systemd-shim出现错误。

如果有任何问题,请将该文件重命名为原来的名称。


18
也有这个问题,从16.04到18.04。您的解决方案也在那里。
Haydentech '18

@Haydentech我也是,Ubuntu升级是如此痛苦Askubuntu.com/questions/1085665/…–
baptx
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.