Failed to start OpenDKIM DomainKeys Identified Mail

After following the tutorial at https://www.linuxbabe.com/mail-server/setting-up-dkim-and-spf, when trying to start opendkim with the command: systemctl start opendkim.service
The following message appears:
Job for opendkim.service failed because the control process exited with error code.
See "systemctl status opendkim.service" and "journalctl -xe" for details.
$ journalctl -xe
Jan 30 14:54:49 localhost systemd [1]: opendkim.service: Start request repeated too quickly.
Jan 30 14:54:49 localhost systemd [1]: opendkim.service: Failed with result 'exit-code'.
Jan 30 14:54:49 localhost systemd [1]: Failed to start OpenDKIM DomainKeys Identified Mail (DKIM) Milter.

  • Subject: Unit opendkim.service has failed

Any idea ??

System: Ubuntu Server 18.04

6 Replies

I'm getting the same and I followed this:

https://www.linode.com/docs/email/postfix/configure-spf-and-dkim-in-postfix-on-debian-9/

I know it is Debian rather that Ubuntu, but it seems it should work the same.

System: Ubuntu 18.04 LTS

Your logs (the output of journalctl -xe) is not long enough to see what issue the OpenDKIM service is running into. All we can see is that systemd tried to restart the service several times and it failed.

To get more details you can do this:

  • On console (ssh connection) #1 do this, it will print logs from OpenDKIM as it runs
journalctl -f -u opendkim.service
  • On a second console (ssh connection) do this to restart OpenDKIM
systemctl restart opendkim.service

Now back on the first console (ssh connection) you should see enough of the logs to know why the service is failing to start.

I had to change permissions on /var/spool/

and I had two inet_listener pointing to 995

Those got me up and running.

I know this is a super old thread, but I am having the exact same issue… unbuntu 20.04, same error:

systemd[1]: Failed to start OpenDKIM DomainKeys Identified Mail (DKIM) Milter.

I have 20+ tabs open of similar issues, on various distros but I can't find a solution :(

I've gone over the entire install process 3 times now. All permissions are correct.

My key-test works great.

But the DKIM service just wont start.

Anyone on Ubuntu have a solution for this?

Thanks,
Seon

What does systemd(1) have to say after you try to start OpenDKIM:

sudo journalctl -xe

I've had this problem before when the directory in /var/run where OpenDKIM wants to put it's pid/socket files either didn't exist or had the wrong permissions (my /etc/default/opendkim):

# Command-line options specified here will override the contents of
# /etc/opendkim.conf. See opendkim(8) for a complete list of options.
#DAEMON_OPTS=""
# Change to /var/spool/postfix/var/run/opendkim to use a Unix socket with
# postfix in a chroot:
#RUNDIR=/var/run/opendkim
RUNDIR=/var/spool/postfix/var/run/opendkim
#
# Uncomment to specify an alternate socket
# Note that setting this will override any Socket value in opendkim.conf
# default:
SOCKET=local:$RUNDIR/opendkim.sock
# listen on all interfaces on port 54321:
#SOCKET=inet:54321
# listen on loopback on port 12345:
#SOCKET=inet:[email protected]
# listen on 192.0.2.1 on port 12345:
#SOCKET=inet:[email protected]
USER=opendkim
GROUP=opendkim
PIDFILE=/var/run/$NAME.pid
EXTRAAFTER=
#

I use postfix(1) so the socket file has to exist in the chroot'd tree that postfix(1) knows…/var/spool/postfix. I also use a local-domain socket for performance and security…YMMV…

-- sw

Thanks stevewi :)

I actually got it working by following this guide.
https://pepipost.com/tutorials/setup-spf-and-dkim-with-postfix-on-ubuntu/

It seems there are some missing bits in the linode guide specific to Ubuntu and 20.14 with regards to the socket setup that was causing the issue.

It's all working now, so if anyone is setting OpenDKIM up with Ubuntu, that link is the guide to follow.

Cheers,
Seon

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct