Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-6803

Postfix unit start/restart timeouts when change in queue_directory parameter

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Undefined Undefined
    • None
    • rhel-8.7.0
    • postfix
    • None
    • None
    • rhel-net-perf
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None
    • 57,005

      • Description of problem:
        =======================

      If parameter queue_directory is defined and postfix is started via systemctl with `systemctl restart postfix` causes timeout issue.

      ~~~
      [root@localhost postfix]# systemctl start postfix
      Job for postfix.service failed because a timeout was exceeded.
      See "systemctl status postfix.service" and "journalctl -xe" for details.

      [root@localhost postfix]# 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: timeout) since Fri 2023-08-18 05:40:23 BST; 1min 9s ago
      Process: 62423 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
      Process: 62421 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
      Process: 62418 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
      Process: 62416 ExecStartPre=/usr/sbin/restorecon -R /var/spool/postfix/pid/master.pid (code=exited, status=0/SUCCESS)

      Aug 18 05:40:23 localhost systemd[1]: postfix.service: start operation timed out. Terminating.
      Aug 18 05:40:23 localhost systemd[1]: postfix.service: Failed with result 'timeout'.
      Aug 18 05:40:23 localhost systemd[1]: Failed to start Postfix Mail Transport Agent.
      ~~~

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

      Producible in RHEL8 and RHEL9 but not in RHEL7

      • How reproducible:
        =================

      Always

      • Steps to Reproduce:
        ==================

      1. Make a custom queue directory and make sure correct permissions and context set.

      ~~~

      1. mkdir /mailqueue
        ~~~

      2. Change parameter in /etc/postfix/main.cf

      ~~~
      #queue_directory = /var/spool/postfix
      queue_directory = /mailqueue
      ~~~

      3. Restart postfix

      • Actual results:
        ==============
      • Unit fails with 'timeout'
      • Expected results:
      • Postfix starts without issue.
      • Additional info:
        ================

      => Not reproducible in RHEL7. Only in RHEL8 and RHEL9

      => Upon changing queue_directory, postfix creates pid inside $queue_directory/pid/ but systemd still waiting for /var/spool/postfix/pid/master.pid which makes unit in activating state and fails when timeout (90 seconds) reaches

      => We can manually start the postfix with `# postfix start` command

      => Workaround:

      1. Copy the unit file to /etc/ which is recommended while making changes to unit file:

      ~~~

      1. cp /usr/lib/systemd/system/postfix.service /etc/systemd/system/postfix.service
      2. vi /etc/systemd/system/postfix.service
        ~~~

      2. Change below lines:

      ~~~
      PIDFile=/mailqueue/pid/master.pid
      ExecStartPre=-/usr/sbin/restorecon -R /mailqueue/pid/master.pid
      ~~~

      3. save the file

      4. reload daemon and restart the service

      1. systemctl daemon-reload
      2. systemctl restart postfix

              jskarvad Jaroslav Škarvada
              rhn-support-smahanga Shreyas Mahangade
              Jaroslav Škarvada Jaroslav Škarvada
              Frantisek Hrdina Frantisek Hrdina
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: