Bug 2031189 - postfix fails to start at boot if configured to speak to the network
Summary: postfix fails to start at boot if configured to speak to the network
Alias: None
Product: Fedora
Classification: Fedora
Component: postfix
Version: 36
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2021-12-10 18:07 UTC by Kenny G
Modified: 2023-05-25 16:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Last Closed: 2023-05-25 16:57:05 UTC
Type: Bug

Attachments (Terms of Use)

Description Kenny G 2021-12-10 18:07:45 UTC
Description of problem:

postfix fails to start at boot if configured to speak to the network

Version-Release number of selected component (if applicable):


How reproducible:


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
--- a/postfix/main.cf
+++ b/postfix/main.cf
@@ -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
4. Reboot
5. Observe that postfix did not start.
6. systemctl status postfix.service will output: "no local interface found"

Complete output

$ 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)
        CPU: 151ms

Dec 10 12:54:50 fedora-rawhide.trickster.gods systemd[1]: Starting Postfix Mail Transport Agent...
Dec 10 12:54:51 fedora-rawhide.trickster.gods postfix[844]: fatal: parameter inet_interfaces: no local interface found for
Dec 10 12:54:52 fedora-rawhide.trickster.gods systemd[1]: postfix.service: Control process exited, code=exited, status=1/FAILURE
Dec 10 12:54:52 fedora-rawhide.trickster.gods systemd[1]: postfix.service: Failed with result 'exit-code'.
Dec 10 12:54:52 fedora-rawhide.trickster.gods systemd[1]: Failed to start Postfix Mail Transport Agent.

Actual results:

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.

Expected results:

Postfix should start at boot after being configured to use a network interface.

Additional info:

How to fix this:

In /usr/lib/systemd/system/postfix.service
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
-After=syslog.target network.target
+After=syslog.target network-online.target
 Conflicts=sendmail.service exim.service


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

Thank you,
Kenneth Stailey

Comment 1 Kenny G 2021-12-10 19:17:40 UTC
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
   6.403s plymouth-quit-wait.service
   2.130s initrd-switch-root.service
   1.279s postfix.service
   1.276s lvm2-monitor.service
    825ms firewalld.service

Making this change will not cause postfix.service to hang the system when the network is not running.

Comment 2 Ben Cotton 2022-02-08 21:21:55 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 3 Kenny G 2022-07-30 15:10:27 UTC
Postfix started correctly at boot with

$ grep After= /usr/lib/systemd/system/postfix.service
After=network-online.target nss-lookup.target

I think by the time nss-lookup.target is reached the WAN/LAN network interface has to be up.

Comment 4 Ben Cotton 2023-04-25 16:46:45 UTC
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.

Comment 5 Ludek Smid 2023-05-25 16:57:05 UTC
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
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.