How to Fix Dovecot error: Socket already exists: /var/run/dovecot/auth-master on cPanel

Dovecot fail

Introduction to Dovecot

Dovecot is an open source POP/IMAP server for Linux/Unix. It is considered to be more secure than other available alternatives. It is a cross platform service and run fines on Linux, Unix, Solaris, FreeBSD, Mac and AIX. Dovecot also supports IMAP+SSL and POP+SSL protocols. Dovecot is strong enough to support IPv6 networking as well.

cPanel, a leading web site hosting control panel , uses two mail servers, Courier and Dovecot. Dovecot is considered to be most widely used due to its features and security. You can login your server WHM and browse to “Mail Server Selection” option to see which mail server is enabled for your server.

Disclaimer:  For accurate results, next steps/commands mentioned in the article should be performed/run with root level privileges

If you are using dovecot and run into following error when attempting to restart this service via command line or WHM:

Error: service(auth): Socket already exists: /var/run/dovecot/auth-master on cPanel

Dovecot fail

No Need to panic, it can be fixed easily  🙂

Reason for Error

This error occurs if there are any hung dovecot processes. When this happens, cPanel service manager is unable to properly kill running processes so restart attempt results in failures as port is already occupied by any process. You can further check dovecot logs as well to verify that server is unable to kill or bound to specified IMAP/POP ports.

Fixing the Error

Fixing the error is pretty easy, we just need to kill currently running dovecot processes using a one liner script and start dovecot fresh.  Run following one liner script on your terminal to kill all stuck dovecot processes.

for i in `ps aux | grep dovecot | awk '{print $2}'` ; do kill -9 $i ; done

Now start dovecot by running cPanel dovecot start script.


Verify that dovecot has been started fine by running the following commands.

telnet localhost 110
telnet localhost 143

Sample output for above commands should look like:

telnet localhost 110


Connected to localhost.

Escape character is '^]'.

+OK Dovecot ready.


localhost 143


Connected to localhost.

Escape character is '^]'



cPanel uses dovecot as its default mail server and they do provide support for issues relating to dovecot operations. You will hardly run into any problem regarding dovecot which can’t be resolve easily, if this is the case, contact cPanel technical support and they should be able to resolve it for you.