# Dovecot fails to restart with failed: Address already in use

**URL:** <https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473>\
**Category:** NodeWorx\
**Created:** [March 3, 2021, 6:45pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473 "2021-03-03T18:45:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 3, 2021, 6:45pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/1 "2021-03-03T18:45:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IWorx-Jenna](https://forums.interworx.com/user_avatar/forums.interworx.com/iworx-jenna/32/41_2.png) [@IWorx-Jenna](https://forums.interworx.com/u/IWorx-Jenna)\
**Post date:** [March 3, 2021, 7:03pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/2 "2021-03-03T19:03:35Z")

</div>

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. 🙂

-Jenna

---

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 3, 2021, 7:15pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/3 "2021-03-03T19:15:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 5, 2021, 12:51pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/4 "2021-03-05T12:51:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IWorx-Jenna](https://forums.interworx.com/user_avatar/forums.interworx.com/iworx-jenna/32/41_2.png) [@IWorx-Jenna](https://forums.interworx.com/u/IWorx-Jenna)\
**Post date:** [March 5, 2021, 7:12pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/5 "2021-03-05T19:12:26Z")

</div>

Hello–

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

-Jenna

---

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 5, 2021, 7:53pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/6 "2021-03-05T19:53:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IWorx-Jenna](https://forums.interworx.com/user_avatar/forums.interworx.com/iworx-jenna/32/41_2.png) [@IWorx-Jenna](https://forums.interworx.com/u/IWorx-Jenna)\
**Post date:** [March 5, 2021, 8:22pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/7 "2021-03-05T20:22:24Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 5, 2021, 8:23pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/8 "2021-03-05T20:23:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 15, 2021, 6:23pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/9 "2021-03-15T18:23:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![iworx-brandon](https://forums.interworx.com/user_avatar/forums.interworx.com/iworx-brandon/32/1432_2.png) [@iworx-brandon](https://forums.interworx.com/u/iworx-brandon)\
**Post date:** [March 21, 2021, 7:07pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/10 "2021-03-21T19:07:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [March 22, 2021, 8:43pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/12 "2021-03-22T20:43:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![iworx-brandon](https://forums.interworx.com/user_avatar/forums.interworx.com/iworx-brandon/32/1432_2.png) [@iworx-brandon](https://forums.interworx.com/u/iworx-brandon)\
**Post date:** [March 22, 2021, 9:44pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/13 "2021-03-22T21:44:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [March 23, 2021, 8:15am UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/14 "2021-03-23T08:15:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![iworx-brandon](https://forums.interworx.com/user_avatar/forums.interworx.com/iworx-brandon/32/1432_2.png) [@iworx-brandon](https://forums.interworx.com/u/iworx-brandon)\
**Post date:** [March 23, 2021, 9:05pm UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/15 "2021-03-23T21:05:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nico](https://forums.interworx.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@Nico](https://forums.interworx.com/u/Nico)\
**Post date:** [March 24, 2021, 10:22am UTC](https://forums.interworx.com/t/dovecot-fails-to-restart-with-failed-address-already-in-use/21473/16 "2021-03-24T10:22:29Z")

</div>

@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
