On a Rocky Linux version 8.5 machine (a bug-for-bug compatible Red Hat Enterprise Linux downstream), I have configured Postfix + Dovecot setup. After troubleshooting all configuration errors, I got to the point where both services would at least launch.
systemctl enable dovecot.service
systemctl enable postfix.service
After restarting the machine, I could see Dovecot launched properly when queried using systemctl status dovecot
. Postfix, on the other hand, failed to start, reporting:
[root@mail ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since ...; 12min ago
Process: 1419 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
Process: 1396 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 1364 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
systemd[1]: Starting Postfix Mail Transport Agent...
postfix/postfix-script[1506]: fatal: the Postfix mail system is already running
systemd[1]: postfix.service: Control process exited, code=exited status=1
systemd[1]: postfix.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Postfix Mail Transport Agent.
A quick check using postfix status
showed indeed it is not running. Surprisingly though, postfix start
then started the service without any issues. Querying postfix status
then reported Postfix is happily running with a new PID. Querying systemctl status postfix
one more time after that showed the unchanged error report from before.
The error reported makes no sense, however. I can systemctl disable postfix
, restart the machine, check Postfix is truly not running using both systemctl status postfix
and postfix status
, try to enable it using systemctl start postfix
and get the same error.
Furthermore, if I leave Postfix service disabled in systemd, reboot the machine and only start it with postfix start
, the service kicks in, but systemctl status postfix
reports it as loaded, inactive...
[root@mail ~]# postfix start
postfix/postfix-script: starting the Postfix mail system
[root@mail ~]# postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 2169
[root@mail ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@mail ~]#
Why does Postfix on RHEL even come registered as a service when it categorically refuses to work as such? And what is then the proper way to ensure Postfix starts at boot?
Note: I tried chkconfig postfix on
as I found it suggested by people online. That merely forwards the request to systemctl enable postfix.service
which leads me back to the start.
... do I really have to hack it in using /etc/rc.local
, when the contents of the file itself say it's there only for compatibility purposes, shouldn't be used anymore and I should consider working with systemd services?
UPDATE 1: I went with what seemed like a reasonable workaround for the time being - starting postfix using the postfix start
command in /etc/rc.local
. After reboot, Postfix still wasn't running. Checking the status of the rc-local service using systemctl status rc-local
, the service failed to start, the reason in the logs being exactly the same as the reasons stated in the Postfix service logs after I enabled it through systemctl
- "fatal: the Postfix mail system is already running". Postfix is simply failing to start at startup under all conditions.