Postfix failed to start at boot

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix failed to start at boot

linkcheck
I have a private postfix server on my local network. It runs under
Manjaro. On booting Manjaro I get half a dozen ERROR lines as:

FAILED: Failed to start (eg) Postfix

All are to do with postfix, dmarc, dkim etc.

I've wondered for some time now why I have to start postfix manually
after reboot but haven't had time to track it down. Since I usually
drive the machine through Remmina I never see the boot sequence, so have
previously missed this.

Postfix runs without a manual restart but dkim/dmarc leave complaints in
the log about having no path to the PID files. When starting them
manually I use:

===============
   sudo mkdir /var/run/opendkim/
   sudo chown -R opendkim:opendkim /var/run/opendkim
   sudo systemctl enable opendkim
   sudo systemctl start opendkim

   sudo mkdir /var/run/opendmarc/
   sudo chown -R opendmarc:postfix /var/run/opendmarc
   sudo chmod -R 774 /var/run/opendmarc
   sudo systemctl enable opendmarc
   sudo systemctl start opendmarc
   sudo systemctl restart postfix
===============
(the sequence is probably incorrect: I have to run the second block
twice before I get the proper ownership of opendmarc)

I checked the status of postfix immediately after boot and before
restarting it manually and got...

===============
postfix.service - Postfix Mail Transport Agent
      Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled;
vendor preset: disabled)
      Active: active (running) since Sat 2020-07-04 15:55:09 BST; 2min
27s ago
     Process: 742 ExecStart=/usr/bin/postfix start (code=exited,
status=0/SUCCESS)
    Main PID: 851 (master)
       Tasks: 8 (limit: 9148)
      Memory: 19.7M
      CGroup: /system.slice/postfix.service
              ├─ 851 /usr/lib/postfix/bin/master -w
              ├─ 867 pickup -l -t fifo -u -o content_filter= -o
receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
              ├─ 868 qmgr -l -t fifo -u
              ├─1591 smtpd -n smtp -t inet -u -o stress= -s 2 -o
content_filter=
              ├─1592 proxymap -t unix -u
              ├─1593 tlsmgr -l -t unix -u
              ├─1594 anvil -l -t unix -u
              └─1604 smtpd -n smtp -t inet -u -o stress= -s 2 -o
content_filter=

Jul 04 15:55:02 SSPH systemd[1]: postfix.service: Scheduled restart job,
restart counter is at 3.
Jul 04 15:55:02 SSPH systemd[1]: Stopped Postfix Mail Transport Agent.
Jul 04 15:55:02 SSPH systemd[1]: Starting Postfix Mail Transport Agent...
Jul 04 15:55:03 SSPH systemd[1]: postfix.service: Control process
exited, code=exited, status=1/FAILURE
Jul 04 15:55:03 SSPH systemd[1]: postfix.service: Failed with result
'exit-code'.
Jul 04 15:55:03 SSPH systemd[1]: Failed to start Postfix Mail Transport
Agent.
Jul 04 15:55:04 SSPH systemd[1]: postfix.service: Scheduled restart job,
restart counter is at 4.
Jul 04 15:55:04 SSPH systemd[1]: Stopped Postfix Mail Transport Agent.
Jul 04 15:55:04 SSPH systemd[1]: Starting Postfix Mail Transport Agent...
Jul 04 15:55:09 SSPH systemd[1]: Started Postfix Mail Transport Agent.
===============

I do not know how to fix this failure. Any help, please? I have asked
this question in the Manjaro forum but with no resolution.

--
dstiles

Reply | Threaded
Open this post in threaded view
|

Re: Postfix failed to start at boot

Christian Kivalo


On July 23, 2020 2:33:04 PM GMT+02:00, Linkcheck <[hidden email]> wrote:

>I have a private postfix server on my local network. It runs under
>Manjaro. On booting Manjaro I get half a dozen ERROR lines as:
>
>FAILED: Failed to start (eg) Postfix
>
>All are to do with postfix, dmarc, dkim etc.
>
>I've wondered for some time now why I have to start postfix manually
>after reboot but haven't had time to track it down. Since I usually
>drive the machine through Remmina I never see the boot sequence, so
>have
>previously missed this.
>
>Postfix runs without a manual restart but dkim/dmarc leave complaints
>in
>the log about having no path to the PID files. When starting them
>manually I use:
>
>===============
>   sudo mkdir /var/run/opendkim/
>   sudo chown -R opendkim:opendkim /var/run/opendkim
>   sudo systemctl enable opendkim
>   sudo systemctl start opendkim
>
>   sudo mkdir /var/run/opendmarc/
>   sudo chown -R opendmarc:postfix /var/run/opendmarc
>   sudo chmod -R 774 /var/run/opendmarc
If the distribution packages don't take care that the necessary directories under /var/run are created, need to create them after every boot.
Look at man 5 tmpfiles.d and create the necessary files in /etc/tmpfiles.d

>   sudo systemctl enable opendmarc
>   sudo systemctl start opendmarc
>   sudo systemctl restart postfix
>===============
>(the sequence is probably incorrect: I have to run the second block
>twice before I get the proper ownership of opendmarc)
>
>I checked the status of postfix immediately after boot and before
>restarting it manually and got...
>
>===============
>postfix.service - Postfix Mail Transport Agent
>     Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled;
>vendor preset: disabled)
>      Active: active (running) since Sat 2020-07-04 15:55:09 BST; 2min
>27s ago
>     Process: 742 ExecStart=/usr/bin/postfix start (code=exited,
>status=0/SUCCESS)
>    Main PID: 851 (master)
>       Tasks: 8 (limit: 9148)
>      Memory: 19.7M
>      CGroup: /system.slice/postfix.service
>              ├─ 851 /usr/lib/postfix/bin/master -w
>              ├─ 867 pickup -l -t fifo -u -o content_filter= -o
>receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
>              ├─ 868 qmgr -l -t fifo -u
>              ├─1591 smtpd -n smtp -t inet -u -o stress= -s 2 -o
>content_filter=
>              ├─1592 proxymap -t unix -u
>              ├─1593 tlsmgr -l -t unix -u
>              ├─1594 anvil -l -t unix -u
>              └─1604 smtpd -n smtp -t inet -u -o stress= -s 2 -o
>content_filter=
>
>Jul 04 15:55:02 SSPH systemd[1]: postfix.service: Scheduled restart
>job,
>restart counter is at 3.
>Jul 04 15:55:02 SSPH systemd[1]: Stopped Postfix Mail Transport Agent.
>Jul 04 15:55:02 SSPH systemd[1]: Starting Postfix Mail Transport
>Agent...
>Jul 04 15:55:03 SSPH systemd[1]: postfix.service: Control process
>exited, code=exited, status=1/FAILURE
>Jul 04 15:55:03 SSPH systemd[1]: postfix.service: Failed with result
>'exit-code'.
>Jul 04 15:55:03 SSPH systemd[1]: Failed to start Postfix Mail Transport
>
>Agent.
>Jul 04 15:55:04 SSPH systemd[1]: postfix.service: Scheduled restart
>job,
>restart counter is at 4.
>Jul 04 15:55:04 SSPH systemd[1]: Stopped Postfix Mail Transport Agent.
>Jul 04 15:55:04 SSPH systemd[1]: Starting Postfix Mail Transport
>Agent...
>Jul 04 15:55:09 SSPH systemd[1]: Started Postfix Mail Transport Agent.
>===============
>
>I do not know how to fix this failure. Any help, please? I have asked
>this question in the Manjaro forum but with no resolution.

--
Christian Kivalo
Reply | Threaded
Open this post in threaded view
|

Re: Postfix failed to start at boot

linkcheck
Thank you for your response, Christian. Sorry not to have replied
earlier, several things on at the moment. :(

I can't say what the boot screen indicates this time as I have no
monitor set up for the m/c at the moment.

The tmpfiles.d folder was empty. I added in two files (info obtained
from an Archlinux bbs):

   opendkim.conf
     D /run/opendkim 0750 opendkim opendkim

   opendmarc.conf
     D /run/opendmarc 0750 opendmarc postfix

That set the folder permissions correctly. Postfix itself failed
completely, though after boot there are two files in each opendmarc/dkim
folder:

   opendkim.pid (permissions: root:root)
   opendkim.sock (permissions: opendkim:postfix)

   opendmarc.pid (permissions: opendmarc:mail)
   opendmarc.sock (permissions: opendmarc:mail)

/etc/opendkim/opendkim.con contains...
   UMask 002
   userid opendkim:postfix
   PidFile /var/run/opendkim/opendkim.pid
   Socket /var/run/opendkim/opendkim.sock

/etc/opendmarc/opendmarc.con contains...
   UMask 002
   UserID opendmarc:postfix
   PidFile /var/run/opendmarc/opendmarc.pid
   Socket unix:/var/run/opendmarc/opendmarc.sock

Postfix status immediately after boot:
=============
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 2020-07-24 15:01:14
BST; 15min ago
     Process: 684 ExecStart=/usr/bin/postfix start (code=exited,
status=1/FAILURE)

Jul 24 15:01:14 SSPH systemd[1]: postfix.service: Control process
exited, code=exited, status=1/FAILURE
Jul 24 15:01:14 SSPH systemd[1]: postfix.service: Failed with result
'exit-code'.
Jul 24 15:01:14 SSPH systemd[1]: Failed to start Postfix Mail Transport
Agent.
Jul 24 15:01:14 SSPH systemd[1]: postfix.service: Scheduled restart job,
restart counter is at 5.
Jul 24 15:01:14 SSPH systemd[1]: Stopped Postfix Mail Transport Agent.
Jul 24 15:01:14 SSPH systemd[1]: postfix.service: Start request repeated
too quickly.
Jul 24 15:01:14 SSPH systemd[1]: postfix.service: Failed with result
'exit-code'.
Jul 24 15:01:14 SSPH systemd[1]: Failed to start Postfix Mail Transport
Agent.
=============

Question: Are the permissions set correctly for dkim/dmarc? I notice
they are different and not entirely the same as I set up in tmpfiles.d,
but they do work.


The postfix log has half a dozen lines:
   Jul 24 15:01:09 [postfix] fatal: parameter inet_interfaces: no local
interface found for 10.0.0.91

These refer to:
   inet interfaces = 127.0.0.1 10.0.0.91
the latter being the m/c IP

I ran a subset of my previous start commands and everything now ALMOST
works (until the next boot)...
===============
   sudo chown -R opendkim:opendkim /var/run/opendkim
   sudo systemctl start opendkim

   sudo chown -R opendmarc:postfix /var/run/opendmarc
   sudo systemctl start opendmarc

   sudo systemctl restart postfix
===============

The log shows permission denied for dkim, which it didn't before.
Something is still not right.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix failed to start at boot

Viktor Dukhovni
On Fri, Jul 24, 2020 at 06:41:36PM +0100, Linkcheck wrote:

> Thank you for your response, Christian. Sorry not to have replied
> earlier, several things on at the moment. :(
>
> I can't say what the boot screen indicates this time as I have no
> monitor set up for the m/c at the moment.
>
> The tmpfiles.d folder was empty. I added in two files (info obtained
> from an Archlinux bbs):
>
>    opendkim.conf
>      D /run/opendkim 0750 opendkim opendkim
>
>    opendmarc.conf
>      D /run/opendmarc 0750 opendmarc postfix

Milters have nothing to do with whether Postfix can or can't start.
The state of "opendkim", et. al. is irrelevant.

> Jul 24 15:01:14 SSPH systemd[1]: postfix.service: Control process
> exited, code=exited, status=1/FAILURE
>
> Question: Are the permissions set correctly for dkim/dmarc? I notice
> they are different and not entirely the same as I set up in tmpfiles.d,
> but they do work.

[irrelevant]

> The postfix log has half a dozen lines:
>    Jul 24 15:01:09 [postfix] fatal: parameter inet_interfaces: no local
> interface found for 10.0.0.91

This is however critical, you're starting Postfix before the network is up.
That, and only that, is your problem.  Ensure that the network is up
before systemd attempts to start Postfix.

--
    Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix failed to start at boot'

Wietse Venema
In reply to this post by linkcheck
I highly recommedn looking at Postfix's onwn logging.

http://www.postfix.org/DEBUG_README.html#logging

        Wietse