清除後 Dovecot-imapd 將無法正確安裝

清除後 Dovecot-imapd 將無法正確安裝

我一直在嘗試運行 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)

當我dir /etc/,我看不到 dovecot 資料夾,如果我使用手動建立它mkdir並將其 chmod 到 777,我仍然收到 20-imap.conf 不存在並且無法建立常規檔案的錯誤。

我在這裡沒有想法,非常感謝你們能給我的任何幫助!

謝謝!

答案1

清除dovecot-common,然後再試一次?運行dpkg --get-selections | grep dovecot,確保每個 dovecot 套件都被清除。 dpkg -P packagename,如果您已將其刪除,但未清除檔案。

一旦確定所有 dovecot 軟體包都消失了,請確保刪除/etc/dovecot嘗試手動建立的目錄。

/etc/dovecot/etc/dovecot/conf.d屬於dovecot-common包。僅刪除 dovecot-imapd 套件不會刪除這些目錄。我猜你手動刪除了它們,或者發生了其他奇怪的事情。

答案2

    apt-get purge....

    based on dpkg --get-selections | grep dovecot (which was a life saver) the output should be:
    dovecot-core     install(those 2 remain no matter what one is using aptitude or apt)
    then run:
    type dovecot
    dovecot is /usr/sbin/dovecot
    rm /usr/sbin/dovecot
    rm -r /etc/dovecot
    dpkg -P 'dovecot-core'(ignore warnings)and dont forget the ''.

    After this do a clean install.

相關內容