Description of problem:
postfix fails to start at boot if configured to speak to the network
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Steps to Reproduce:
1. Install postfix rpm
2. Configure /etc/postfix/main.cf to use a network interface:
$ git diff main.cf
diff --git a/postfix/main.cf b/postfix/main.cf
index bd0aea8..fb28e96 100644
@@ -131,8 +131,8 @@ mail_owner = postfix
#inet_interfaces = all
#inet_interfaces = $myhostname
-#inet_interfaces = $myhostname, localhost
-inet_interfaces = localhost
+inet_interfaces = $myhostname, localhost
+#inet_interfaces = localhost
3. Activate postfix: sudo systemctl enable --now postfix.service
5. Observe that postfix did not start.
6. systemctl status postfix.service will output: "no local interface found"
$ systemctl status postfix.service
× postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2021-12-10 12:54:52 EST; 8min ago
Process: 826 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
Process: 843 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 844 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
Dec 10 12:54:50 fedora-rawhide.trickster.gods systemd: Starting Postfix Mail Transport Agent...
Dec 10 12:54:51 fedora-rawhide.trickster.gods postfix: fatal: parameter inet_interfaces: no local interface found for 127.0.0.2
Dec 10 12:54:52 fedora-rawhide.trickster.gods systemd: postfix.service: Control process exited, code=exited, status=1/FAILURE
Dec 10 12:54:52 fedora-rawhide.trickster.gods systemd: postfix.service: Failed with result 'exit-code'.
Dec 10 12:54:52 fedora-rawhide.trickster.gods systemd: Failed to start Postfix Mail Transport Agent.
Configuring postfix to use a network interface prevents it from starting at boot because the postfix.service unit file is set to wait for the wrong target.
Postfix should start at boot after being configured to use a network interface.
How to fix this:
Change this: After=syslog.target network.target
Into this: After=syslog.target network-online.target
Same as diff:
$ diff -u /usr/lib/systemd/system/postfix.service.DIST /usr/lib/systemd/system/postfix.service
--- /usr/lib/systemd/system/postfix.service.DIST 2021-08-05 05:29:06.000000000 -0400
+++ /usr/lib/systemd/system/postfix.service 2021-12-10 10:23:44.445754863 -0500
@@ -1,6 +1,6 @@
Description=Postfix Mail Transport Agent
You do not have to change any of the "wait online" unit files, they can stay in their default settings:
$ systemctl list-unit-files | grep -- -wait-
NetworkManager-wait-online.service enabled enabled
systemd-networkd-wait-online.service disabled disabled
systemd-time-wait-sync.service disabled disabled
Booting with the network cable detached and then running 'systemd-analyze blame' shows that postfix.service only took 1.279 seconds.
$ systemd-analyze blame
1min 77ms NetworkManager-wait-online.service
Making this change will not cause postfix.service to hang the system when the network is not running.
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.
Postfix started correctly at boot with
$ grep After= /usr/lib/systemd/system/postfix.service
I think by the time nss-lookup.target is reached the WAN/LAN network interface has to be up.
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version'
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora Linux 36 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.
Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.
If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.
If you are unable to reopen this bug, please file a new report against an
Thank you for reporting this bug and we are sorry it could not be fixed.