Dovecot fails to restart with failed: Address already in use

Hi,
Not sure if this is a bug but customers called me that the mail has stopped to work.
Looking in Nodeworx Home the Dovecot service was down, but it didn’t want to restart, looking in the dovecot.log this message was there:

Mar 03 14:09:15 master: Error: service(submission-login): listen(*, 587) failed: Address already in use
Mar 03 14:09:15 master: Error: service(submission-login): listen(::, 587) failed: Address already in use
Mar 03 14:09:15 master: Fatal: Failed to start listeners

For some reason it thinks the port was in use and restarting all the mail related services didn’t help. I had to reboot the server in the end.

Why does it happen as the server was up and running for 70+ days [Siteworx version is 6.9.0 VPS]

Thanks Nico

Hello–

I’ve come across this a handful of times–for some reason the smtp2 process is still running on servers that use the Dovecot MSA–that is what is holding port 587. I’ve never really found a specific cause, since I’ve not been able to reproduce it on a test server, just seen it on a few customer boxes.

To resolve the issue, though, you just have to run the following, which will permanently disable smtp2:

svstat /service/smtp2 (checks if smtp2 is running. In your situation, it will be)
svc -d /service/smtp2 (disables smtp2)

I’d run the svstat command again, to make sure that smtp2 is no longer running.

You should then be able to restart Dovecot.

Let me know if that works. :slight_smile:

-Jenna

1 Like

Hi @IWorx-Jenna,
Thanks for the fast response, it looks like we had many IMAP sessions from same IP, but not sure if that would be the cause of the issue, will look into your commands next time it happens, thank you,
Nico

HI @IWorx-Jenna Morning, had another server having this issue, used your commands and restarted dovecot, it looked OK, but after a few minutes it stopped again…

I have found that when going into the MSA settings and change the Max smtp connections per user ip: from say 50 to 10 it fails with error:

» There was a problem validating the form. Please see details below.
» Dovecot failed to restart; reverting to previous settings.

Restarting Dovecot again by re-submitting the change it seems to be stable, perhaps something in that form? I Hope that helps you to pinpoint the issue.

Kind regards,
Nico

Hello–

I was unable to reproduce that error on a test server. :frowning: Is it something that is constantly reproducible on yours?

-Jenna

Hi @IWorx-Jenna Jenna,
No it is sporadic, this is 3th time in months. if there is anything in the logs I can send let me know, but no rush at all enjoy the weekend.
Nico

If there is anything weird logged, I think it would be in the iworx.log. But I’m not certain anything would have been.

If that error it comes up again, for you, submit a ticket and we can take a closer look. :slight_smile:

1 Like

@IWorx-Jenna Hi Jenna,
Will do.
Kind regards,
Nico

Hi @IWorx-Jenna,
It happened several times again, I am creating support ticket and access on server now so you can investigate it, Nico

EDIT: All sorted now

1 Like

Hello–

To aid folks who may be Google searching this error, the typical cause is as Jenna mentioned earlier: the older smtp2 service has jumped in front of Dovecot and taken over port 587. The instructions she provided above can stop the smtp2 process and allow you to get Dovecot started. For folks who have already migrated to Dovecot Submission for port 587, it is safe to remove the smtp2 executable to ensure that it won’t jump in front of Dovecot again in the future. The executable is located in /service/smtp2/. Removal of that entire folder should work. This is only likely to happen on servers that have been around long enough that they were migrated from smtp2 to Dovecot at some point in the history. Newer installs have defaulted to Dovecot for over a year now.

1 Like

Hi

Thanks Iworx-Brandon - good to clarify for everyone.

I will let @Nico know as we had a conversion about this over removing smtp2, and as it always needed for 587 or secondary port, was my belief it was needed still unless dovecot used it’s own

Is it dovecot uses a single port range 25, 465 and 587 (or user input port) or is it is uses 25 then upgrades to 587 if starttls is sent and can it do explicit 587

Many thanks

John

I’m having some difficulty parsing your questions, so please let me know if I’m not answering how you expect.

I think the confusion over what is needed or not likely is the result of there being two processes in the old way of handling SMTP (smtp and smtp2). smtp is qmail running on port 25. This is still needed and should not be removed under any circumstance. smtp2 is qmail running on port 587. This is now not needed provided that you are using dovecot-submission. Dovecot only handles submission on port 587/465 (or another custom port) and then hands it off to qmail using port 25 for all the smtp processing. Qmail is still handling all of the background stuff, Dovecot just has the ability to hand off to it while providing some cool additions like SNI which we didn’t have with qmail.

1 Like

Hi

@iworx-brandon - many thanks, and you have answered the question thank you

I think it is a communication issue over the dovecot changes which causes confusion to those of us who were used to older versions

I now understand and will delete the smtp2 folders and let @Nico know as well

Many thanks

John

@d2d4j You can also just remove the executable bit on /services/smtp2/run if you would prefer a less destructive method.

1 Like

@iworx-brandon
I have removed it on all ‘old’ servers, all fine so far.
You can also remove the /var/log/smtp2 folder
Kind regards,
Nico

1 Like