系统环境:Ubuntu 16.04.3 LTS
Sometimes a Debian or Ubuntu package does not install correctly and can not be uninstalled. The system update is so completely broken that conventional commands, whether apt-get, ability or dpkg, not corrects the problem.
类似的出现如下故障报错
[root@master]$ apt-get install slapd
[…]
Preparing to replace slapd 2.4.25-1+b1 (using .../slapd_2.4.25-1.1_i386.deb) ...
sed: can't read /etc/ldap/slapd.d/cn=config.ldif: No such file or directory
invoke-rc.d: initscript slapd, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
sed: can't read /etc/ldap/slapd.d/cn=config.ldif: No such file or directory
invoke-rc.d: initscript slapd, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/slapd_2.4.25-1.1_i386.deb (--unpack):
subprocess new pre-removal script returned error exit status 2
configured to not write apport reports
Backing up /etc/ldap/slapd.d in /var/backups/slapd-2.4.25-1.1... done.
grep: /etc/ldap/slapd.d/cn=config/olcDatabase*: No such file or directory
sed: can't read /etc/ldap/slapd.d/cn=config.ldif: No such file or directory
invoke-rc.d: initscript slapd, action "start" failed.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/slapd_2.4.25-1.1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
解决办法就是:手动删除/var/lib/dpkg/info/
下相应的[文件名].*
。如上冲突文件是s/var/cache/apt/archives/slapd_2.4.25-1.1_i386.deb
,则检索slapd.*
。然后mv
或者rm
相应的文件。
删除后,执行两次sudo apt-get autoremove
命令,就会提示没有进程冲突了。
参考文章: How to fix a broken or half installed Debian deb package
网友评论