#779269 opensmtpd not started at boot with sysv

Package:
opensmtpd
Source:
opensmtpd
Description:
secure, reliable, lean, and easy-to configure SMTP server
Submitter:
David Maslen
Date:
2026-03-17 19:21:01 UTC
Severity:
normal
Tags:
#779269#5
Date:
2015-02-26 09:21:19 UTC
From:
To:
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 ***

#779269#12
Date:
2018-03-18 10:07:55 UTC
From:
To:
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

#779269#17
Date:
2018-11-15 21:16:37 UTC
From:
To:

#779269#22
Date:
2020-12-09 21:52:47 UTC
From:
To:
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

#779269#39
Date:
2025-10-13 19:54:03 UTC
From:
To:
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.

#779269#44
Date:
2025-10-13 20:17:31 UTC
From:
To:
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.

#779269#49
Date:
2026-03-17 18:52:35 UTC
From:
To:
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.