2

I have been trying to get a dovecot/postfix server up an running to serve e-mail for my start up business, and I too have fallen victim to poorly written, outdated guides.

At first I installed Postfix and Dovecot, and selected an empty configuration thinking I'd configure it all myself. At a certain point I lost track of what I was actually doing and what I had configured, so I decided to apt-purge all the packages I had installed and start over.

After trying to install dovecot using sudo apt-get install dovecot-imapd, I'm running into the following error:

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)

When I dir /etc/, I can't see a dovecot folder, and if I create it manually using mkdir and chmod it to 777, I still get the error that 20-imap.conf doesn't exist and that it cannot create a regular file.

I'm out of ideas here and would greatly appreciate any help you guys can give me!

Thanks!

aevitas
  • 123
  • 1
  • 5

2 Answers2

6

Purge dovecot-common, and try again? Run dpkg --get-selections | grep dovecot, make sure every dovecot package is purged. dpkg -P packagename, if you have already removed it, but not purged the files.

Once you are sure all the dovecot packages are gone, make sure you delete the /etc/dovecot directory that you tried to manually create.

The /etc/dovecot, and /etc/dovecot/conf.d belong to the dovecot-common package. Deleting only the dovecot-imapd package would not have deleted those directories. I am guessing you manually removed them, or something else weird happened.

Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • 1
    Thanks for the answer! How do I ensure I have purged and removed all the dovecot related packages? when I run `dpkg --get-selections | grep dovecot` I get a list of packages that don't include common and imapd - are those installed on my system too or are those the available packages? – aevitas Sep 13 '13 at 22:12
  • 1
    The `dpkg --get-selections` shows you what is installed, or in a removed state. If you have other dovecot packages, you probably need to remove those as well. – Zoredache Sep 13 '13 at 22:22
  • 1
    After having played with this until deep in the night I finally managed to get it working thanks to your answer. Marking your answer as accepted, thanks for the help! – aevitas Sep 14 '13 at 11:36
  • 1
    I had to remove dovecot-core too (thanks to `dpkg --get-selections | grep dovecot`) – Thomas Jul 01 '14 at 17:46
-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.