Opendkim won't start: can't open PID file?
Solution 1:
I fixed it by specifying the PidFile
in the /etc/opendkim.conf
file:
PidFile /var/run/opendkim/opendkim.pid
I think it's better to solve it here than modifying the systemd script. Also, systemd recommends the PIDFile
option if the Type
option is set to forking
, which it seems to be in this service.
This PidFile
setting was present in the default /etc/opendkim.conf
file. However, I replaced that file while I was following a tutorial for configuring OpenDKIM. So that is where it went wrong for me.
Solution 2:
Since this daemon runs alone, systemd doesn't need anything special to manage it. Importantly, having a "PIDFile" directive suggests that it's a more complicated service, and will put a PID into the PIDFile on it's own.
The solution is to remove the PIDFile line. Now systemd handles it just fine.
Solution 3:
In my case was due to the fact that /var/run
was a symlink to /run
. After changing the PIDFile
path from /var/run/opendkim/opendkim.pid
in /run/opendkim/opendkim.pid
in opendkim.service
, the problem went away.