Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login

15 posts / 0 new
Last post
#1 Tue, 02/05/2019 - 18:57
adamjedgar

Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login

tried to run an update, however encountered the following problem...

Setting up dovecot-core (1:2.2.27-3+deb9u3) ...
Job for dovecot.service failed because the control process exited with error code.
See "systemctl status dovecot.service" and "journalctl -xe" for details.
invoke-rc.d: initscript dovecot, action "start" failed.
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-02-06 11:34:46 AEDT; 11ms ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 15944 ExecStart=/usr/sbin/dovecot (code=exited, status=89)
Main PID: 937 (code=exited, status=0/SUCCESS)

Feb 06 11:34:45 server3 systemd[1]: Starting Dovecot IMAP/POP3 email server...
Feb 06 11:34:46 server3 dovecot[15944]: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login
Feb 06 11:34:46 server3 systemd[1]: dovecot.service: Control process exited, code=exited status=89
Feb 06 11:34:46 server3 systemd[1]: Failed to start Dovecot IMAP/POP3 email server.
Feb 06 11:34:46 server3 systemd[1]: dovecot.service: Unit entered failed state.
Feb 06 11:34:46 server3 systemd[1]: dovecot.service: Failed with result 'exit-code'.
dpkg: error processing package dovecot-core (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of dovecot-pop3d:
dovecot-pop3d depends on dovecot-core (= 1:2.2.27-3+deb9u3); however:
  Package dovecot-core is not configured yet.

dpkg: error processing package dovecot-pop3d (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of dovecot-imapd:
dovecot-imapd depends on dovecot-core (= 1:2.2.27-3+deb9u3); however:
  Package dovecot-core is not configured yet.

dpkg: error processing package dovecot-imapd (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
dovecot-core
dovecot-pop3d
dovecot-imapd

When i look at the dovecot server, it isnt running. When i try to start it i get the following error

Failed to Start Dovecot Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login

If i enter the following

[admin@server3 ~]# sudo ps aux | grep -v grep | grep dovecot

it outputs

root     16885  0.0  0.2  22516  5188 ?        S    11:53   0:00 dovecot/config
dovecot  16886  0.0  0.1  20520  2560 ?        S    11:53   0:00 dovecot/auth
root     30002  0.0  0.0  18128   860 ?        Ss    2018   0:13 /usr/sbin/dovecot
dovecot  30007  0.0  0.0   9492    92 ?        S     2018   0:02 dovecot/anvil
root     30008  0.0  0.0   9624   164 ?        S     2018   0:02 dovecot/log

if i then do the following

[admin@server3 root]# sudo rm -f /var/run/dovecot/master.pid
[admin@server3 root]# sudo service dovecot restart
Job for dovecot.service failed because the control process exited with error code.
See "systemctl status dovecot.service" and "journalctl -xe" for details.
[admin@server3 root]# systemctl status dovecot.service
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-02-06 11:58:46 AEDT; 29s ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 17848 ExecStart=/usr/sbin/dovecot (code=exited, status=89)
Main PID: 937 (code=exited, status=0/SUCCESS)

Feb 06 11:58:46 server3 systemd[1]: Starting Dovecot IMAP/POP3 email server...
Feb 06 11:58:46 server3 dovecot[17848]: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login
Feb 06 11:58:46 server3 systemd[1]: dovecot.service: Control process exited, code=exited status=89
Feb 06 11:58:46 server3 systemd[1]: Failed to start Dovecot IMAP/POP3 email server.
Feb 06 11:58:46 server3 systemd[1]: dovecot.service: Unit entered failed state.
Feb 06 11:58:46 server3 systemd[1]: dovecot.service: Failed with result 'exit-code'.

I have read forums comments about this formerly being a bug but is it? how do i fix?

Tue, 02/05/2019 - 19:17
adamjedgar

in the end, i was force to completely reset the Server.

(tried just restarting apache and postfix, then dovecot, but none of those worked). Once the entire server was reset, dovecot started working again. Makes me think thsi may be a good reason for keeping mail on a completely different machine.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Wed, 02/13/2019 - 05:07
SteveR

I am also getting the same error when I attempt to reload dovecot config after making changes....

But dovecot seems to be still running.....

And the error message keeps recurring in the mail logs...

Any ideas?

Thu, 02/14/2019 - 14:17 (Reply to #3)
adamjedgar

The only thing i could do was completely restart the server (hard reset). It all seemed to work once i did that.

If it has a lot of production websites hosted on it, you might want to let your clients know this has to be done and shedule a time for it to happen.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Thu, 02/14/2019 - 16:07
noisemarine

Or you could just kill the running processes manually?

Tue, 03/19/2019 - 05:39
adamjedgar

I have had this same problem again. Dovecot refused to start with the same error. Solution was to do as you suggested noisemarine and kill the dovecot process in webmin>system>running processes

  1. scroll down the list until i found a dovecot process,
  2. click on said process
  3. then in the dialouge box select Kill

once i did this i was then able to go to webmin>servers>Dovecot IMAP POP3 Server>Start (she fired up no problems)

What could be causing this?

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Sun, 06/16/2019 - 11:29
calderwood
calderwood's picture

I've been getting this on a clean Centos7 install with a clean GPL install. Tried on Centos6 install - works. Back to Centos7 install, the error message triyng to start Dovecot is: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login Dovecot is in fact running:

dovecot (Dovecot IMAP server)
ID CPU Started Command
9816 0.0 % Jun14 dovecot/anvil
15732 0.0 % 12:18 dovecot/auth

But the CP still says not running. I stop the processes but the anvil keeps restarting.

systemctl status dovecot.service
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2019-06-16 12:03:49 EDT; 18min ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 12454 ExecStart=/usr/sbin/dovecot (code=exited, status=89)
  Process: 12451 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
Main PID: 3856 (code=exited, status=0/SUCCESS)

Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net systemd[1]: Starting Dovecot IMAP/POP3 email ser.....
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net dovecot[12454]: master: Fatal: Dovecot is already...n
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net dovecot[12454]: Fatal: Dovecot is already running...n
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net systemd[1]: dovecot.service: control process exi...89
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net systemd[1]: Failed to start Dovecot IMAP/POP3 em...r.
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net systemd[1]: Unit dovecot.service entered failed ...e.
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net systemd[1]: dovecot.service failed.
Jun 16 12:04:10 ip-64-202-xxx-10.ip.secureserver.net systemd[1]: Unit dovecot.service cannot be reloa...e.
Hint: Some lines were ellipsized, use -l to show in full.

David Calderwood - Euro-Pacific Digital Media

Sun, 06/16/2019 - 18:58
calderwood
calderwood's picture

Forgot to post the expanded error message:

journalctl -b _PID=12454
-- Logs begin at Sun 2019-06-16 10:59:37 EDT, end at Sun 2019-06-16 19:51:14 EDT. --
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net dovecot[12454]: master: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login
Jun 16 12:03:49 ip-64-202-xxx-10.ip.secureserver.net dovecot[12454]: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login

dovecot is NOT working even thought it says it is running.

David Calderwood - Euro-Pacific Digital Media

Tue, 06/18/2019 - 16:07
calderwood
calderwood's picture

Fixed the problem by removing Dovecot and installing a fresh Dovecot install from the Webmin archive. Fixed the issue.

David Calderwood - Euro-Pacific Digital Media

Thu, 06/20/2019 - 06:30
adamjedgar

Thats interesting...i wonder whwt is wrong with the full auto install that is fixed by removing and then manually installing just dovecot?

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Mon, 08/26/2019 - 10:09
calderwood
calderwood's picture

I spoke too soon. The same error has returned.

systemctl status dovecot.service
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-08-26 10:33:52 EDT; 2min 54s ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/

Aug 26 10:33:51 ip-xxx-10.ip.secureserver.net systemd[1]: Starting Dovecot IMAP/POP3 email server...
Aug 26 10:33:52 ip-64-xxx10.ip.secureserver.net dovecot[12637]: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login
Aug 26 10:33:52 ip-64-xxx-10.ip.secureserver.net dovecot[12637]: master: Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot...n/login
Aug 26 10:33:52 ip-64-xxx-10.ip.secureserver.net systemd[1]: dovecot.service: control process exited, code=exited status=89
Aug 26 10:33:52 ip-64-xxx-10.ip.secureserver.net systemd[1]: Failed to start Dovecot IMAP/POP3 email server.
Aug 26 10:33:52 ip-64-xxx-10.ip.secureserver.net systemd[1]: Unit dovecot.service entered failed state.
Aug 26 10:33:52 ip-64-xxx-10.ip.secureserver.net systemd[1]: dovecot.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

In Webmin it shows as not working and gives an error if you try to start.

Failed to start Dovecot :
Fatal: Dovecot is already running? Socket already exists: /var/run/dovecot/login/login

But run

ps aux | grep -v grep | grep dovecot
root      8645  0.0  0.0  16080  1192 ?        Ss   10:16   0:00 /usr/sbin/dovecot
root      8647  0.0  0.0   9872  1340 ?        S    10:16   0:00 dovecot/log
root      8649  0.0  0.9  46728 36324 ?        S    10:16   0:01 dovecot/config
dovenull 12598  0.0  0.1  44228  4252 ?        S    10:33   0:00 dovecot/imap-login
lisa@eu+ 12605  0.0  0.2  52152  8844 ?        S    10:33   0:00 dovecot/imap
dovenull 12612  0.0  0.1  44220  4256 ?        S    10:33   0:00 dovecot/imap-login
david@e+ 12616  0.0  0.1  28072  5496 ?        S    10:33   0:00 dovecot/imap
dovecot  12619  0.0  0.0   9740  1128 ?        S    10:33   0:00 dovecot/anvil
root     14178  0.0  0.0   9736   856 ?        S    10:39   0:00 dovecot/ssl-params
dovenull 14189  0.0  0.1  44228  4252 ?        S    10:39   0:00 dovecot/imap-login
lisa@eu+ 14193  0.0  0.0  17556  2192 ?        S    10:39   0:00 dovecot/imap
dovenull 14447  0.0  0.1  44228  4256 ?        S    10:41   0:00 dovecot/imap-login
dovecot  14448  0.0  0.0  34508  2384 ?        S    10:41   0:00 dovecot/auth
root     14449  0.1  0.0  38712  2660 ?        S    10:41   0:00 dovecot/auth -w
pam@hr-+ 14453  0.2  0.0  18916  3712 ?        S    10:41   0:00 dovecot/imap
dovenull 14457  0.0  0.1  44228  4256 ?        S    10:41   0:00 dovecot/imap-login
pam@hr-+ 14463  0.0  0.0  17888  2448 ?        S    10:41   0:00 dovecot/imap

As you see Dovecot is running. If I run

systemctl status dovecot.service dovecot.service
- Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-08-26 10:33:52 EDT; 10min ago

David Calderwood - Euro-Pacific Digital Media

Mon, 08/26/2019 - 13:45
mark_kendall

Have just experienced this and found that I had some domains still attached after deletion which were causing checks for missing ssl certs in /etc/dovecot/dovecot.conf

Thu, 10/03/2019 - 12:46
primoco

I confirm the problem are some duplicate records into /etc/dovecot/dovecot.conf. There is some records as the follows:

local_name xxxxx.it {
ssl_cert = </home/xxxxx/ssl.cert
ssl_key = </home/xxxxx/ssl.key
}
local_name www.xxxxx.it {
ssl_cert = </home/xxxxx/ssl.cert
ssl_key = </home/xxxxx/ssl.key
}
local_name mail.xxxxx.it {
ssl_cert = </home/xxxxx/ssl.cert
ssl_key = </home/xxxxx/ssl.key
}
local_name xxxxx.it {
ssl_cert = </home/xxxxx/ssl.cert
ssl_key = </home/xxxxx/ssl.key
  ssl_ca = </home/xxxxx/ssl.ca
}
local_name www.xxxxx.it {
ssl_cert = </home/xxxxx/ssl.cert
ssl_key = </home/xxxxx/ssl.key
  ssl_ca = </home/xxxxx/ssl.ca
}
local_name mail.xxxxx.it {
ssl_cert = </home/xxxxx/ssl.cert
ssl_key = </home/xxxxx/ssl.key
  ssl_ca = </home/xxxxx/ssl.ca
}

Virtualmin create 2 records 1 with ssl.ca and another without i delete without and now i'm able to restart and upgrade with no problem

After restart dovecot via virtualmin seams to recreate some duplicate entry and the error come back again!

Mon, 10/21/2019 - 01:44
paul_intermediatica

I had the same issue after restarting dovecot. Here is what worked for me:

Edited /etc/dovecot/conf.d/10-ssl.conf Deleting one old domain that was no longer in Virtualmin (causing dovecot to crash) After crashing, some orfaned procceses was still running, preventing Dovecot to start again.

To kill all processes remaining, I just did:

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

And all done! Back again.

Paul Marti interMediática MX

Mon, 12/16/2019 - 15:38
adamjedgar

I have had this issue again...and once again, i had to go into my service provider and shutdown and restart the VPS instance.

After the last time, i had setup a system monitor to auto restart any service that fails, and it tried to do that automatically during the night...however, each time it failed. I even tried to reboot the system from inside virtualmin, this did not correct the problem with dovecot. This is very frustrating.

There is something wrong in virtualmin coding that must be causing this. I note that i have had some SSL auto renewals yesterday via webmin/virtualmin...something is not right.

Here is an email my main account recieved from webmin@host.fqdn at 23.04 last nite (just before the dovecot system went down)

From
webmin@host.fqdn (where fqdn is the same as my host domain)
To
virtual server@fqdn
Date 16/12/2019 23:04
Subject
Let's Encrypt certificate renewal complete
Message contents
A new certificate was successfully requested from Let's Encrypt, and installed for
fqdn, www.fqdn, mail.fqdn, host.fqdn.

I think we need to file a bug report about this...i cant have this issue every 3 months when the webmin SSL cert renews

Can anyone help with implementing the following automatically using system monitor? (I already have a script to attempt to restart dovecot, but i need to set it to automatically kill all stuck processes first)

As paul suggested above...

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

start dovecot by running dovecot start script.

service dovecot restart


how can we combine these into a single command to add into server monitor to auto restart?

Also, someone on stack suggested the following

I suspect the Webmin uses certbot as a backend. You can check it running systemctl list-timers to see if certbot.timer is active. If this is the case you can use certbot's pre and post hooks to stop and start dovecot during certificate renewal.

https://certbot.eff.org/docs/using.html

The renew command includes hooks for running commands or scripts before or after a certificate is renewed. For example, if you have a single certificate obtained using the standalone plugin, you might need to stop the webserver before renewing so standalone can bind to the necessary ports, and then restart it after the plugin is finished. Example:

certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"


any advice on the idea of using a certbot hook to sort this? (obviously i am using apache, however, shouldnt virtualmin already be doing this?)

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Topic locked