Debian – Postfix only starts after “systemctl daemon-reload”

debianemailpostfixsystemd

Today I upgraded Postfix and everything was running fine until I decided to let the server reboot just to see if everything comes back up.

Everything went just fine but systemd seems to "ignore" the Postfix startup:

Oct  7 22:59:25 [REDACTED] systemd[1]: Stopped Postfix Mail Transport Agent.
Oct  7 22:59:25 [REDACTED] systemd[1]: Stopping Postfix Mail Transport Agent...
Oct  7 22:59:25 [REDACTED] systemd[1]: Starting Postfix Mail Transport Agent...
Oct  7 22:59:25 [REDACTED] systemd[1]: Started Postfix Mail Transport Agent.

As you can see it shows nothing about the Postfix startup which is expected to be like this:

postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
postfix/postfix-script: starting the Postfix mail system

When I type

service postfix start

the start process goes way too fast and looking into the process list with

ps -ef

doesn't list any Postfix services like pickup, tlsmgr, etc.

Now to fix this I found out that I simply have to reload systemd with

systemctl daemon-reload

When using

service postfix start

systemd does it's job as it should be:

Oct  7 23:00:08 [REDACTED] systemd[1]: Reloading.
Oct  7 23:00:08 [REDACTED] systemd[1]: apt-daily-upgrade.timer: Adding 15min 23.517714s random time.
Oct  7 23:00:08 [REDACTED] systemd[1]: apt-daily.timer: Adding 3h 21min 57.996507s random time.


Oct  7 23:00:28 [REDACTED] systemd[1]: Created slice system-postfix.slice.
Oct  7 23:00:28 [REDACTED] systemd[1]: Starting Postfix Mail Transport Agent (instance -)...
Oct  7 23:00:29 [REDACTED] postfix[1233]: Postfix is running with backwards-compatible default settings
Oct  7 23:00:29 [REDACTED] postfix[1233]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Oct  7 23:00:29 [REDACTED] postfix[1233]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
Oct  7 23:00:30 [REDACTED] postfix/postfix-script[1333]: starting the Postfix mail system
Oct  7 23:00:30 [REDACTED] postfix/master[1335]: daemon started -- version 3.1.6, configuration /etc/postfix
Oct  7 23:00:30 [REDACTED] systemd[1]: Started Postfix Mail Transport Agent (instance -).

When I reboot I have to reload systemd again in order to get Postfix working via the service command. This is a very strange behaviour and I haven't found any answers to this on the internet.

System Specs:

CPU: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
Memory: 12 GB
SSD: 240 GB
OS: Debian 9 Stretch (64-bit)
All packages are up-to-date.
Virtualized with KVM.

postfix.service

[Unit]
Description=Postfix Mail Transport Agent
Conflicts=sendmail.service exim4.service
ConditionPathExists=/etc/postfix/main.cf

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true

[Install]
WantedBy=multi-user.target

postfix@.service

[Unit]
Description=Postfix Mail Transport Agent (instance %i)
Documentation=man:postfix(1)
PartOf=postfix.service
Before=postfix.service
ReloadPropagatedFrom=postfix.service
After=network-online.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
GuessMainPID=no
ExecStartPre=/usr/lib/postfix/configure-instance.sh %i
ExecStart=/usr/sbin/postmulti -i %i -p start
ExecStop=/usr/sbin/postmulti -i %i -p stop
ExecReload=/usr/sbin/postmulti -i %i -p reload

[Install]
WantedBy=multi-user.target

I have tried to fix this with

systemctl enable postfix.service

but that didn't work either.

Thanks for your help!

EDIT: Okay, this is very strange: The "networking" service fails to "raise the network interfaces". But when I run ifconfig the IPv4 and IPv6 interface are up and running correctly.

Okt 10 20:48:43 [REDACTED] ifup[423]: ifup: failed to bring up eth0
Okt 10 20:48:43 [REDACTED] systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Okt 10 20:48:43 [REDACTED] systemd[1]: Failed to start Raise network interfaces.
Okt 10 20:48:43 [REDACTED] systemd[1]: networking.service: Unit entered failed state.
Okt 10 20:48:43 [REDACTED] systemd[1]: networking.service: Failed with result 'exit-code'.

I have touched my interfaces only once by assigning IPs to them 14 months ago.

Best Answer

Okay, what finally helped me out was this simple command:

systemctl enable postfix@-

After rebooting everything starts up fine.