Opendkim doesnt survive reboot

I’m running Ubuntu 18.04LTS and an up to date version of Virtulamin.

I have setup DKIM validation for sending emails from one domain today (purely using the VirtualMin GUI). I got it working and my emails sent now pass DKIM checks. However, I rebooted the machine and did another test and found DKIM sig was not being sent with emails after I rebooted.

I went to System >> Bootup and Shutdown. I found the following:

  1. opendkim is listed, with start at book shows “yes” and running shows “unknown”
  2. When I check the entry and click the green Start button at the bottom the start at boot shows “yes” and running shows “yes”. Now if i send an email DKIM signature is sent.
  3. I checked opendkim and clicked the Start at Boot button at the bottom and the on screen message shows it is set to run at boot. However, if i restart the same issue occurs that it is not running and DKIM signatures are not applied to the emails unless I manually check opendkim and click the start button.

Does anyone have any ideas why it is not starting at boot? Also, on the Bootup and Shutdown page, in addition to opendkim being listed is there also meant to be an entry for opendkim.service? Currently only opendkim exists in the list.

Any ideas?

Hi,

OpenDKIM is enabled by default.

root@debug-ubuntu18-pro:~# 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 Mon 2020-11-16 16:52:36 MSK; 2min 39s 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: 889 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf (code=exited, status=0/SUCCESS)
 Main PID: 921 (opendkim)
    Tasks: 6 (limit: 2314)
   CGroup: /system.slice/opendkim.service
           └─921 /usr/sbin/opendkim -x /etc/opendkim.conf

Nov 16 16:52:36 debug-ubuntu18-pro.local systemd[1]: Starting OpenDKIM DomainKeys Identified Mail (DKIM) Milter...
Nov 16 16:52:36 debug-ubuntu18-pro.local systemd[1]: Started OpenDKIM DomainKeys Identified Mail (DKIM) Milter.
Nov 16 16:52:36 debug-ubuntu18-pro.local opendkim[921]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)

If you run systemctl status opendkim before and after the system is rebooted, are the outputs differ?

Hi Ilia,

I am not getting exactly what you have… something is disabled. Also, it is not the same after a reboot as it is after I start the service manually.

Here is what I get after a reboot:

Blockquote
[alexcruncha@host ~]# systemctl status opendkim
● opendkim.service - OpenDKIM DomainKeys Identified Mail (DKIM) Milter
Loaded: loaded (/lib/systemd/system/opendkim.service; disabled; vendor preset: enabled)
Active: inactive (dead)
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

And here is what I get after I start the service manually:

Blockquote
[alexcruncha@host ~]# systemctl status opendkim
● opendkim.service - OpenDKIM DomainKeys Identified Mail (DKIM) Milter
Loaded: loaded (/lib/systemd/system/opendkim.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2020-11-16 19:44:55 UTC; 14s 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: 3843 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf (code=exited, status=0/SUCCESS)
Main PID: 3853 (opendkim)
Tasks: 6 (limit: 4658)
CGroup: /system.slice/opendkim.service
└─3853 /usr/sbin/opendkim -x /etc/opendkim.conf
Nov 16 19:44:55 host systemd[1]: Starting OpenDKIM DomainKeys Identified Mail (DKIM) Milter…
Nov 16 19:44:55 host systemd[1]: opendkim.service: Can’t open PID file /var/run/opendkim/opendkim.pid (yet?) after start: No such file or directory
Nov 16 19:44:55 host opendkim[3853]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)
Nov 16 19:44:55 host systemd[1]: Started OpenDKIM DomainKeys Identified Mail (DKIM) Milter.

In both cases I notice the opendkim.service shows disabled on the first line:
Loaded: loaded (/lib/systemd/system/opendkim.service; disabled; vendor preset: enabled)

I also see:
Can’t open PID file /var/run/opendkim/opendkim.pid

Does that help? I checked and the file /var/run/opendkim/opendkim.pid file is there. Permissions is set to 660 and its owned by root:root while the containing folder is owned by opendkim:opendkim

Do you think its a permissions or ownership issue?

I’ve fixed the issue. For some reason the service was disabled so I ran the following:

The service now automatically starts when the system is rebooted.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.