dovecot start "Address already in use" error

Solution 1:

Just did an upgrade on an AWS Linux instance and dovecot wouldn't start with Address already in use errors (same as original poster).

netstat and lsof didn't show any process attached to those TCP ports.

Eventually I discovered that as part of the upgrade the portreserve package was installed. It had a config file /etc/portreserve/dovecot which had listed the problematic ports. I renamed the file to /etc/portreserve/dovecot~ and now everything works fine.

According to because portreserve only does a bind() to the port, and doesn't do a listen() it won't show up in lsof or netstat. That makes it really tricky to troubleshoot.

Solution 2:

This command will show you what's listening:

$ sudo netstat -lnp | grep 993
tcp        0      0   *               LISTEN      4470/imap-login

The last column gives you the PID and name of the process bound to that particular port.