我在卸载 dovecot 时遇到了问题。在尝试修复它时,我却让情况变得更糟。以下是“日志”:
Errors were encountered while processing:
dovecot-imapd
dovecot-pop3d
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@gasimzada:/usr/lib# apt-get remove -f dovecot-imapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
dovecot-imapd dovecot-pop3d
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 976 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 43903 files and directories currently installed.)
Removing dovecot-imapd ...
doveconf: error while loading shared libraries: libdovecot.so.0: cannot open shared object file: No such file or directory
[....] Starting IMAP/POP3 mail server: dovecot/usr/sbin/dovecot: error while loading shared libraries: libdovecot.so.0: cannot open shared object file: No such file or directory
failed!
invoke-rc.d: initscript dovecot, action "start" failed.
dpkg: error processing dovecot-imapd (--remove):
subprocess installed post-removal script returned error exit status 1
Removing dovecot-pop3d ...
doveconf: error while loading shared libraries: libdovecot.so.0: cannot open shared object file: No such file or directory
[....] Starting IMAP/POP3 mail server: dovecot/usr/sbin/dovecot: error while loading shared libraries: libdovecot.so.0: cannot open shared object file: No such file or directory
failed!
invoke-rc.d: initscript dovecot, action "start" failed.
dpkg: error processing dovecot-pop3d (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
dovecot-imapd
dovecot-pop3d
E: Sub-process /usr/bin/dpkg returned an error code (1)
出现错误的原因是我从 /usr/lib 中删除了 dovecot 文件夹,这是一个糟糕的想法。除了删除包而不运行包之外,还有什么其他方法吗?
谢谢,
答案1
这将卸载 Debian 中的 dovecot:
systemctl stop dovecot
systemctl disable dovecot
apt-get purge dovecot-core
apt-get autoremove dovecot-core
答案2
选项 a)
重新安装该包,然后立即将其删除。
选项 b)
调整 post-rm 脚本文件,使其不调用 doveconf。
选项 c)
调整 doveconf 本身,使其成为 /bin/true 的克隆。
答案3
重新安装/卸载/清除对我不起作用。以下方法有效:
这对我有用:
sudo nano /etc/init.d/dovecot
将 exit 0 放在第一行(也可以放在注释后的第二行)保存,然后尝试使用 aptitude-remove 删除损坏的安装
:-)