ubuntu 16.04.5
升级到 ubuntu 18.04.1
出现 systemd-shim
升级失败,重启系统之后,继续执行软件升级,出现如下错误信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$ sudo apt-get dist-upgrade 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 正在计算更新... 完成 下列软件包将被【卸载】: systemd-shim 下列软件包将被升级: apache2 apache2-bin apache2-data apache2-utils libmspack0 linux-firmware 升级了 6 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 0 个软件包未被升级。 有 1 个软件包没有被完全安装或卸载。 需要下载 0 B/72.5 MB 的归档。 解压缩后会消耗 4,250 kB 的额外空间。 您希望继续执行吗? [Y/n] (正在读取数据库 ... 系统当前共安装有 415046 个文件和目录。) 正在卸载 systemd-shim (9-1bzr4ubuntu1) ... 正在删除 systemd-shim 导致 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service 转移到 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd dpkg-divert: 错误: 更改 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd 文件名会覆盖 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service, 不允许此操作 dpkg: 处理软件包 systemd-shim (--remove)时出错: installed systemd-shim package post-removal script subprocess returned error exit status 2 在处理时有错误发生: systemd-shim E: Sub-process /usr/bin/dpkg returned an error code (1) |
如果语言是英文的,可能会出现如下信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$ sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be REMOVED: systemd-shim The following packages will be upgraded: apache2 apache2-bin apache2-data apache2-utils libmspack0 linux-firmware 6 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 0 B/72.5 MB of archives. After this operation, 4,250 kB of additional disk space will be used. Do you want to continue? [Y/n] (Reading database ... 415046 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): installed systemd-shim package post-removal script subprocess returned error exit status 2 Errors were encountered while processing: systemd-shim E: Sub-process /usr/bin/dpkg returned an error code (1) |
解决方案如下:
1 2 3 4 5 |
$ sudo mv /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.bak $ sudo apt-get dist-upgrade $ sudo rm -rf /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.bak |