清除后 Dovecot-imapd 无法正确安装

aev*_*tas 2 debian dovecot

我一直在尝试运行一个 dovecot/postfix 服务器来为我的初创企业提供电子邮件服务,但我也成为写得不好、过时的指南的受害者。

起初我安装了 Postfix 和 Dovecot,并选择了一个空配置,认为我会自己配置它。在某个时候,我忘记了我实际在做什么以及我配置了什么,所以我决定apt-purge我安装的所有软件包并重新开始。

尝试使用 安装 dovecot 后sudo apt-get install dovecot-imapd,我遇到了以下错误:

The following NEW packages will be installed:
  dovecot-imapd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/425 kB of archives.
After this operation, 565 kB of additional disk space will be used.
Selecting previously unselected package dovecot-imapd.
(Reading database ... 23009 files and directories currently installed.)
Unpacking dovecot-imapd (from .../dovecot-imapd_1%3a2.1.7-7_amd64.deb) ...
Setting up dovecot-imapd (1:2.1.7-7) ...

Creating config file /etc/dovecot/conf.d/20-imap.conf with new version
cp: cannot create regular file `/etc/dovecot/conf.d/20-imap.conf': No such file or directory
dpkg: error processing dovecot-imapd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 dovecot-imapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

当我dir /etc/看不到 dovecot 文件夹时,如果我使用手动创建它mkdir并将其 chmod 为 777,我仍然收到错误 20-imap.conf 不存在且无法创建常规文件。

我在这里没有想法,非常感谢你们能给我的任何帮助!

谢谢!

Zor*_*che 6

清除dovecot-common,然后再试一次?运行dpkg --get-selections | grep dovecot,确保清除每个 dovecot 包。 dpkg -P packagename, 如果您已经删除它,但没有清除文件。

一旦您确定所有 dovecot 包都已消失,请确保删除/etc/dovecot您尝试手动创建的目录。

/etc/dovecot,并且/etc/dovecot/conf.d属于dovecot-common包。仅删除 dovecot-imapd 包不会删除这些目录。我猜你手动删除了它们,或者发生了其他奇怪的事情。