6

I'm trying (with minimal success at present) to setup the Dovecot mail server on my Fedora 24 server. I've installed Dovecot and set the conf file up, all fine. But when I run:

systemctl restart dovecot

After editing the conf file I get this message

Job for dovecot.service failed because the control process exited with error code. See "systemctl status dovecot.service" and "journalctl -xe" for details

Running systemctl status dovecot.service gives me a different error

[root@fedora app]# systemctl status dovecot.service
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2016-08-16 15:02:30 UTC; 37min ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 11293 ExecStart=/usr/sbin/dovecot (code=exited, status=89)
  Process: 11285 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)

Aug 16 15:02:30 fedora dovecot[11293]: Error: service(imap-login): listen(*, 993) failed: Address already in use
Aug 16 15:02:30 fedora dovecot[11293]: master: Error: service(imap-login): listen(*, 993) failed: Address already in use
Aug 16 15:02:30 fedora dovecot[11293]: Error: service(imap-login): listen(::, 993) failed: Address already in use
Aug 16 15:02:30 fedora dovecot[11293]: master: Error: service(imap-login): listen(::, 993) failed: Address already in use
Aug 16 15:02:30 fedora dovecot[11293]: Fatal: Failed to start listeners
Aug 16 15:02:30 fedora dovecot[11293]: master: Fatal: Failed to start listeners
Aug 16 15:02:30 fedora systemd[1]: dovecot.service: Control process exited, code=exited status=89
Aug 16 15:02:30 fedora systemd[1]: Failed to start Dovecot IMAP/POP3 email server.
Aug 16 15:02:30 fedora systemd[1]: dovecot.service: Unit entered failed state.
Aug 16 15:02:30 fedora systemd[1]: dovecot.service: Failed with result 'exit-code'.

I tried running lsof -i | grep 993 but this yields no processes. Any idea how to fix this?

  • 1
    Quick comment: try `lsof -i:imaps` or `lsof -i:993` instead of the `grep`. Or just `grep imaps`. Looking for 993 probably failed simply because lsof translated it to the matching name in `/etc/services`. – mattdm Aug 16 '16 at 20:04

2 Answers2

6

netstat is your friend when you're trying to troubleshoot a lot of network-related problems. To find a listening port, I would use netstat -tulpn | grep :<port number>

For example, to find what pids are listening on port 22, I would run:

netstat -tulpn | grep :22
tcp  0  0 0.0.0.0:22    0.0.0.0:*    LISTEN      3062/sshd

That tells me that sshd with pid 3062 is listening on port 22.

Jason Powell
  • 371
  • 2
  • 4
3

You might also like a solution using ss that is more systematic and more precise than grepping port numbers.

# ss -t -l 'sport = 22'
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
LISTEN     0      128        *:ssh                      *:*
LISTEN     0      128       :::ssh                     :::*
Pavel Šimerda
  • 6,394
  • 2
  • 26
  • 33