Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Opensmtpd crashes with listen: Address already in use
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Goverp
l33t
l33t


Joined: 07 Mar 2007
Posts: 921

PostPosted: Mon Aug 17, 2020 6:26 pm    Post subject: Opensmtpd crashes with listen: Address already in use Reply with quote

Having spent ages looking for a small and easy to configure message transfer agent (MTA) to handle all those emails from smartd, mdadm and their ilk locally, I came across OpenSMTPD, which does exactly what I want "out of the box". Well, almost; when I added it to the default runlevel and reboot, I get the following messages in syslog:
Code:
 Aug 17 15:50:43 smtpd[2902]: info: OpenSMTPD 6.7.1p1 starting
 Aug 17 15:50:43 smtpd[2912]: pony express[2912]: pony express: listen: Address already in use
 Aug 17 15:50:43 smtpd[2906]: smtpd: process pony socket closed
 Aug 17 15:51:55 /etc/init.d/smtpd[4260]: status: crashed

The general web advice in such circumstances is to remove the duplicate "listen on" configuration line that's causing the daemon to try reusing the port. but I don't have that!
My /etc/smtpd/smtpd.conf was:
Code:
table aliases file:/etc/mail/aliases

listen on localhost

action "local" maildir alias <aliases>
action "relay" relay

match for local action "local"
match from local for any action "relay"

and my /etc/hosts:
Code:
127.0.0.1       localhost
::1             localhost

192.168.1.1     netgear
192.168.1.2     ryzen

and netstat tells me nothing else was listening on port 25.
My suspicion is that the two localhost entries in /etc/hosts are to blame, so I've tried changing the config file to use
Code:
listen on 127.0.0.1

and that seems to have cured the problem, but I don't understand why, though it looks like IPv6 may be involved. Is my network configuration suspect?
_________________
Greybeard
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1824

PostPosted: Wed Aug 19, 2020 9:55 pm    Post subject: Reply with quote

It randomly happens for me every once in a while, and bouncing the smtpd service resolves it. I'm using systemd.
Code:
Jul 23 19:58:25 systemd[1]: Starting OpenSMTPD...
Jul 23 19:58:25 smtpd[477]: info: OpenSMTPD 6.7.1p1 starting
Jul 23 19:58:25 systemd[1]: Started OpenSMTPD.
Jul 23 19:58:25 smtpd[485]: y express[485]: pony express: listen: Address already in use
Jul 23 19:58:25 smtpd[481]: smtpd: process pony socket closed
Jul 23 19:58:25 systemd[1]: smtpd.service: Main process exited, code=exited, status=1/FAILURE
Jul 23 19:58:25 systemd[1]: smtpd.service: Failed with result 'exit-code'.

I have "listen on localhost" in my config.

Never bothered to investigate it.
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1422

PostPosted: Wed Aug 19, 2020 10:06 pm    Post subject: Reply with quote

Never seen that happen on all 3 machines + some VMs I use it on, but I've been using listen on 127.0.0.1 from the start so it doesn't say much.

On a side-note, sure glad I started to use this. I've used sendmail, postfix, and exim in the past and I'm done with all this nonsense :| This is so much nicer to setup while still being a full featured implementation.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 2481
Location: Frankfurt, Germany

PostPosted: Wed Aug 19, 2020 11:28 pm    Post subject: Reply with quote

Code:
listen on localhost

The man page for smtpd.conf says:
Code:
listen on interface [family] [options]
    Listen on the interface for incoming connections, using the same syntax as for ifconfig(8).
    The interface parameter may also be an interface group, an IP address, or a domain name.

It does not say that it's allowed to use a hostname.
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1422

PostPosted: Thu Aug 20, 2020 12:15 am    Post subject: Reply with quote

mike155 wrote:
It does not say that it's allowed to use a hostname.
The example .conf file given by the package itself has "listen on localhost" so I'd assume it's supposed to be fine unless they don't know how to use their own daemon. Arch's 3 liner example for local mail uses it too.
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1422

PostPosted: Thu Aug 20, 2020 12:27 am    Post subject: Reply with quote

Had a quick look at the upstream issue tracker, while it has no followup yet I did find this somewhat recent open issue, don't know what's up but at least that probably don't make it gentoo-specific.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum