4

I'm currently trying to use some "me@mydomain.com" adresses on my dedicated server (Centos5).

To do so, I'm tring to launch dovecot with /etc/init.d/dovecot start, but I get the following error message :

Starting Dovecot Imap: Error: service(pop3-login): listen(*, 110) failed:
Address already in use
Error: service(pop3-login): listen(*, 995) failed: Address already in use
Error: service(imap-login): listen(*, 143) failed: Address already in use
Error: service(imap-login): listen(*, 993) failed: Address already in use
Fatal: Failed to start listeners
                                                           [FAILED]

Something is already listening on these ports, but I don't know what. Qmail was previously installed on my server, so I removed it, but it didn't solve the problem.

Do you know how to fix this ?

1
  • So, if you run netstat -pan | grep 110 what is using the port? – NickW Jun 17 '13 at 14:24
3

This command will show you what's listening:

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

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

3
  • tcp 0 0 :::993 :::* LISTEN 2771/couriertcpd Thanks I will try to workaround this – Nicolas Reynolds Jun 17 '13 at 14:28
  • There you go! Process 2771 is bound to that port. – Flup Jun 17 '13 at 14:28
  • yum remove psa-courier-imap did the trick. Thanks ! – Nicolas Reynolds Jun 17 '13 at 14:31
8

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 https://bugzilla.redhat.com/show_bug.cgi?id=1570282 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.

4
  • Same problem here. Dovecot was the only thing registered, so removing /etc/portreserve/dovecot prevents portreserve from starting at all. i.e., 'service portreserve start' produces "Starting portreserve: (not starting, no services registered)" – Jef Jul 1 '20 at 15:49
  • 1
    Apparently the missing /etc/portreserve/dovecot file can be replaced by the amazon "yum update" process, so it may be better to leave it in-place, and simply edit it. – greeble31 Oct 30 '20 at 15:18
  • @greeble31 you are correct - much better to edit rather than delete. Since I'd removed the file, I just did an update and it put the (bad) file back. – rsfault Nov 12 '20 at 1:43
  • Same here, but I also had to restart portreserve to get it to release the ports used by the file: service portreserve restart (or you could probably just stop the service and disable it). – Russell G Nov 26 '20 at 14:40
0

Edit dovecot conf and replace :

protocols = imap pop3 imaps pop3s

with

protocols = imap pop3

You might be missing the certificate for SSL ports.

0

I found it was dovecot only on that PID

I ran kill dovecot followed by dovecot it worked fine!

2
  • Did you run killall dovecot or kill <dovecot PID>? – chicks May 27 '16 at 19:42
  • @chicks kill dovecot – KawaiKx May 28 '16 at 8:29
0

This happened to me just now. Disabling the imaps protocol, did not work for some reason, dovecot still tried to open port 993, possibly something to do with startTLS. Anyway netstat did not show any active listening ports:

samuel@extern:/etc/dovecot$ sudo netstat -tulpn | grep 993
samuel@extern:/etc/dovecot$

I did have one ESTABLISHED port tho:

samuel@extern:/etc/dovecot$ sudo netstat -tulpan | grep 993
tcp        0      0 192.168.1.132:993       192.168.1.129:2049      ESTABLISHED -               
samuel@extern:/etc/dovecot$

When I rebooted the virtual machine Dovecot started working again. Further research showed that NFS was interfering. The problem started right after a reboot with:

dovecot: master: Error: service(imap-login): listen(*, 993) failed: Address already in use

NFS uses privileged ports to mount the remote filesystem for some reason. See: https://unix.stackexchange.com/questions/398152/why-is-nfs-client-using-low-numbered-ports

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.