#976194 opensmtpd: Fails to start on boot with systemd

Package:
opensmtpd
Source:
opensmtpd
Description:
secure, reliable, lean, and easy-to configure SMTP server
Submitter:
Yvan Masson
Date:
2023-08-16 13:51:03 UTC
Severity:
normal
Tags:
#976194#5
Date:
2020-12-01 10:46:08 UTC
From:
To:
Dear Maintainer,

My issue is very similar to #779269: opensmtpd fails to automatically
start on boot with the following messages (extracted from journalctl):

   systemd[1]: Starting OpenSMTPD SMTP server...
   smtpd[437]: info: OpenSMTPD 6.0.3-portable starting
   systemd[1]: Started OpenSMTPD SMTP server.
   smtpd[473]: pony express: listen: Address already in use
   smtpd[469]: smtpd: process lka socket closed
   systemd[1]: opensmtpd.service: Main process exited, code=exited,
status=1/FAILURE
   systemd[1]: opensmtpd.service: Failed with result 'exit-code'.

Also, as suggested in #779269, running `systemctl restart opensmtpd` works.

Note that I had the same issue on Stretch before re-installing the
system with Buster. I did not do any tests, but one idea that comes to
my mind is that this issue arises when using a bridge configuration.
Here is my /etc/network/interfaces:

   source /etc/network/interfaces.d/*

   # The loopback network interface
   auto lo
   iface lo inet loopback

   auto br0
   iface br0 inet static
   bridge_ports enp9s0
   address 192.168.1.2/24
   gateway 192.168.1.254
   dns-nameserver 80.67.169.12 80.67.169.40

Regards,
Yvan

#976194#10
Date:
2020-12-09 12:54:22 UTC
From:
To:
Dear Yvan,

Could you please send me a copy of /etc/smtpd.conf? In particular, I'm
curious what "listen on" stanzas you have?

Also, could you please send the verbose output of opensmtpd starting up
at boot? It should be sufficient to

1) Edit /lib/systemd/system/opensmtpd.service and change
        ExecStart=/usr/sbin/smtpd
   to
        ExecStart=/usr/sbin/smtpd -v
2) systemctl daemon-reload
3) reboot
4) Extract the verbose output from the failed start. I think the
   following should do it:
        journalctl -b -0 "_SYSTEMD_UNIT=opensmtpd.service"

Thanks,
Ryan

#976194#17
Date:
2020-12-09 15:05:02 UTC
From:
To:
Le 09/12/2020 à 13:54, Ryan Kavanagh a écrit :

I have a very simple configuration:

listen on localhost
table aliases file:/etc/aliases
table secrets file:/etc/smtpd.secrets
accept for local \
     alias <aliases> \
     deliver to mbox
accept for domain foo.com \
     relay via secure+auth://user@mail-provider:587 \
     auth <secrets> \
     as my@foo.com
Thanks for the detailed instructions. The log is attached.
You are welcome!

#976194#22
Date:
2020-12-09 21:27:34 UTC
From:
To:
Control: forwarded -1 https://github.com/OpenSMTPD/OpenSMTPD/issues/1106
this by adding two identical entries to my /etc/hosts, i.e., by having

    127.0.0.1	localhost
    127.0.0.1	localhost

in my /etc/hosts. By any chance, does your /etc/hosts contain multiple
entries for localhost? In any case, I'll forward this bug upstream now
that I can reproduce it.

Best,
Ryan

#976194#29
Date:
2020-12-10 13:30:35 UTC
From:
To:
Here is my /etc/hosts, which I believe is untouched since install:

127.0.0.1       localhost
127.0.1.1       mydomainname.tld   mydomainame

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Thanks,
Yvan

#976194#38
Date:
2022-02-18 13:36:01 UTC
From:
To:
Hi,

In case it is useful, I confirm that this issue is still present in
Bullseye, running openSMTPd 6.8.0p2-3.

Regards,
Yvan