Opendkim won't start: can't open PID file?
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.
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.