Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1510158 (postfix_network-online.target) - race condition - postfix fails to start due to systemd dependency to network.target after reboot
Summary: race condition - postfix fails to start due to systemd dependency to network....
Keywords:
Status: CLOSED DUPLICATE of bug 1116538
Alias: postfix_network-online.target
Product: Fedora
Classification: Fedora
Component: postfix
Version: 27
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: network-online.target
TreeView+ depends on / blocked
 
Reported: 2017-11-06 19:50 UTC by Michal Ambroz
Modified: 2017-11-06 20:55 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-11-06 20:55:02 UTC


Attachments (Terms of Use)

Description Michal Ambroz 2017-11-06 19:50:00 UTC
Description of problem:
-----------------------
After reboot postfix fails to start with following message in the syslog:
Nov 06 19:17:22 testmachine.example.com postfix[1200]: fatal: parameter inet_interfaces: no local interface found for 127.0.0.2

- The postfix systemd start-script is depending to network.target (and not network-online.target as it probably should be). 
- Due to this it gets to race condition where network-manager is just started but not finished setting-up network interfaces. 
- At this precise point it tries to resolve its $myhostname as defined in /etc/postfix/main.cf or obtained from gethostname() by default and gots 127.0.0.2
- then it tries to identify a local device which has this IP address configured, but doen't find any (it would be wrong address anyway)
- so the start of the service after reboot fails
- then the network manager finishes the network configuration so all the resolving works fine from now on so it is hard to get idea where is this 127.0.0.2 coming from 


Version-Release number of selected component (if applicable):
-------------------------------------------------------------
tested with postfix-3.2.3-1.fc26, but the situation is the same in rawhide and fc27.


How reproducible:
-----------------
Race condition during start of network-manager probably dependent on the number of network cards.
On one of my machines it was failing in 100% cases (machine with cca 10 physical interfaces), but on some different machine I believe it could be 100% success (like machine with only 1 physical network card).


Steps to Reproduce:
-------------------
0. have many network cards
1. instal postfix (dnf -y install postfix)
2. enable it to start automatically (systemctl enable postfix)
3. reboot the machine
4. check the staus after reboot (systemctl status postfix)


Additional info:
----------------
I believe the dependency should be changed from network.target to network-online.target in /usr/lib/systemd/system/postfix.service:

[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network-online.target
Conflicts=sendmail.service exim.service
....

Even if you manualy define correct $myhostname in /etc/postfix/main/cf and its correct IP resolv in /etc/hosts, the postfix service still fails to start at reboot, because at that point it would know the correct IP address, but that would not be ready on some network interface. The error in this situation would be :
Nov 06 19:17:22 testmachine.example.com postfix[1200]: fatal: parameter inet_interfaces: no local interface found for 111.222.33.44


Best regards
Michal Ambroz

Comment 1 Michal Ambroz 2017-11-06 20:55:02 UTC

*** This bug has been marked as a duplicate of bug 1116538 ***


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