I've intalled opensmtpd, configured and tested. It works. However when rebooting it fails to start. /etc/init.d/opensmtpd status shows it is not running. /etc/init.d/opensmtpd start, starts it as you would expect. I am using sysv rather than systemd as the later won't boot correctly with btrfs volumes. *** End of the template - remove these template lines ***
I got the same problem using systemd. mail.log shows Mar 18 09:26:55 mailproxy2-test smtpd[660]: info: OpenSMTPD 6.0.3-portable starting Mar 18 09:26:55 mailproxy2-test smtpd[666]: pony express: smtpd: bind: Cannot assign requested address Mar 18 09:26:55 mailproxy2-test smtpd[662]: smtpd: process pony socket closed If I login and run "service opensmtpd start" then smtpd starts as expected. "ip a s" at boot time shows that the IP address it tries to bind to is set to "tentative", still. Regards Harri
Dear David, Harald, I wanted to follow up and see if you were still having issues with opensmtpd not starting at boot. Could you please update the init script to start smtpd with the -v flag, and send me the verbose startup output for smtpd after a reboot? I think it should be sufficient to apply the attached patch to /etc/init.d/opensmtpd before rebooting. The output should be in /var/log/mail.log . I suspect this bug might be related to this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976194 Thanks, Ryan
I can confirm this is still an issue on Debian 12.12:
Version: 7.4.0p1-1~bpo12+1
Logs:
systemd[1]: Started opensmtpd.service - OpenSMTPD SMTP server.
smtpd[682]: dispatcher: smtpd: bind: Cannot assign requested address
smtpd[668]: warn: parent -> dispatcher: imsg_read: Connection reset by peer
smtpd[668]: smtpd: exiting: Connection reset by peer
systemd[1]: opensmtpd.service: Main process exited, code=exited, status=1/FAILURE
I do not have two versions of localhost in /etc/hosts.
Inspecting the service configuration (systemctl show opensmtpd.service)
I observe that "After=" includes "network.target". According to [1],
that target does not guarantee that all the network interfaces are up.
[1] https://systemd.io/NETWORK_ONLINE/
As (cautiously) recommended there, if I modify [Unit]After=/Wants= to
include network-online.target, then opensmtpd starts successfully on
boot.
I suspect the "real" issue is that opensmtpd is not designed to be
started before the interfaces in its configuration file exist.
interface up is where things go wrong. I would hazard a guess that statically configured network system aren't seeing this. Otherwise there would presumably be far more reports.
Hi, Ryan, The linked bug (#976194) is unrelated, since the fix here is in the systemd unit, which is shipped with Debian. As Mark correctly points out, the ordering of units needs adjusting, since the network may come online way after the service starts.