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.
--
Mark Lawrence