Package: opendkim
Version: 2.11.0~alpha-10+deb9u1

OpenDKIM fails on boot but works fine when restarted manually. First, let's investigate the state after reboot:

$ systemctl status opendkim

● opendkim.service - OpenDKIM DomainKeys Identified Mail (DKIM) Milter
   Loaded: loaded (/lib/systemd/system/opendkim.service; enabled; vendor preset: enabled)    Active: failed (Result: exit-code) since Sun 2020-09-27 10:18:19 UTC; 1min 38s ago
     Docs: man:opendkim(8)
           man:opendkim.conf(5)
           man:opendkim-genkey(8)
           man:opendkim-genzone(8)
           man:opendkim-testadsp(8)
           man:opendkim-testkey
           http://www.opendkim.org/docs.html
  Process: 1001 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf (code=exited, status=78)

/var/log/mail.err and mail.info contains no error messages.

Restarting opendkim manually resolves the problem, leading me to believe that it is starting too early.

$ systemctl restart opendkim
$ systemctl status opendkim

● opendkim.service - OpenDKIM DomainKeys Identified Mail (DKIM) Milter
   Loaded: loaded (/lib/systemd/system/opendkim.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-09-27 10:21:08 UTC; 6s ago
     Docs: man:opendkim(8)
           man:opendkim.conf(5)
           man:opendkim-genkey(8)
           man:opendkim-genzone(8)
           man:opendkim-testadsp(8)
           man:opendkim-testkey
           http://www.opendkim.org/docs.html
  Process: 1611 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf (code=exited, status=0/SUCCESS)
 Main PID: 1614 (opendkim)
    Tasks: 7 (limit: 4915)
   CGroup: /system.slice/opendkim.service
           ├─1614 /usr/sbin/opendkim -x /etc/opendkim.conf
           └─1616 /usr/sbin/opendkim -x /etc/opendkim.conf

Sep 27 10:21:08 cloudmail systemd[1]: Starting OpenDKIM DomainKeys Identified Mail (DKIM) Milter... Sep 27 10:21:08 cloudmail systemd[1]: Started OpenDKIM DomainKeys Identified Mail (DKIM) Milter. Sep 27 10:21:08 cloudmail opendkim[1616]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)

As a permanent fix, I made opendkim start after MariaDB by modifying the service definition:

$ nano -w /etc/systemd/system/multi-user.target.wants/opendkim.service

I changed
After=network.target nss-lookup.target
to
After=network.target nss-lookup.target mariadb.service

OpenDKIM now starts as expected when rebooting.

Regards
Jimmy Thomsen

Reply via email to