postfix starts before network manager is done

Issues related to applications and software problems and general support
Post Reply
helgew
Posts: 3
Joined: 2017/06/05 00:19:50

postfix starts before network manager is done

Post by helgew » 2020/11/19 19:50:08

Hi,

on a new CentOS 8 VM installation with a single NIC that is configured to use DHCP, postfix is starting before NetworkManager is finished starting up. This, inevitably, leads to postfix exiting with the following error (I have substituted "example.com" for the actual host name):

Code: Select all

● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2020-11-19 11:45:41 PST; 30s ago
  Process: 949 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
  Process: 946 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 912 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)

Nov 19 11:45:40 localhost.localdomain systemd[1]: Starting Postfix Mail Transport Agent...
Nov 19 11:45:40 localhost.localdomain postfix[949]: fatal: config variable inet_interfaces: host not found: example.com
Nov 19 11:45:41 localhost.localdomain systemd[1]: postfix.service: Control process exited, code=exited status=1
Nov 19 11:45:41 localhost.localdomain systemd[1]: postfix.service: Failed with result 'exit-code'.
Nov 19 11:45:41 localhost.localdomain systemd[1]: Failed to start Postfix Mail Transport Agent.
Interfaces to bind to are defined in main.cf as

Code: Select all

inet_interfaces = $myhostname, localhost
I have also tried the IP address (fixed via DHCP server configuration) there with the same result.

If I log in to the VM and restart postfix manually, it happily starts up.

Any advice would be greatly appreciated.

rk11
Posts: 1
Joined: 2020/11/20 10:27:55

Re: postfix starts before network manager is done

Post by rk11 » 2020/11/20 10:33:13

Had the same issue, probably an update installed on November 15 which created this.

It can be solved as follows:
vi /usr/lib/systemd/system/postfix.service

At the end of the third line from the top add: network-online.target, so it looks like this.
After=syslog.target network.target network-online.target

Issue: systemctl daemon-reload

And test with a reboot, it worked on my Centos 8.

User avatar
TrevorH
Forum Moderator
Posts: 29915
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: postfix starts before network manager is done

Post by TrevorH » 2020/11/20 16:16:45

It can be solved as follows:
vi /usr/lib/systemd/system/postfix.service
Wrong solution, sorry.

If you edit the file you mention then it will be replaced next time there is a package update. To make changes to package supplied unit files you should either create an override file in /etc/systemd/system/$service.d/ or you should copy the entire unit file from /usr to /etc and amend it there.

And I suspect it's the wrong solution anyway, more likely the correct thing to do is to edit the ifcfg file for the connection and add LINKDELAY=15 so give it a 15s leeway for the interface to come ready before it continues.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 8 - General Support”