what causes “systemd: Failed at step USER spawning /usr/sbin/opendkim: No such process”

How can I remove following error:

systemd: Failed at step USER spawning /usr/sbin/opendkim: No such process

It occurs when I try to start opendkim service on Centos.


Solution 1:

I've just ran into this and in my case it was caused by quoting a user name in my service file:

[Unit]
Description=Demonstrate Failed at step USER spawning ...: No such process error when user name is quoted

[Service]
User="tadeusz"
ExecStart=/bin/echo hello

[Install]
WantedBy=multi-user.target

Starting this service on Ubuntu 16.04.2 LTS (Amazon EC2 instance) would fail with following error:

user-example.service: Failed at step USER spawning /bin/echo: No such process

Interestingly, on Ubuntu Gnome 17.04 (my local machine), the error message is much more helpful:

[/etc/systemd/system/user-example.service:5] Invalid user/group name or numeric ID, ignoring: "tadeusz"

Removing quotes in both environments resolved the problem:

[Service]
User=tadeusz

Solution 2:

Check if the following record exists in the configuration file of opendkim:

## Attempt to become the specified user before starting operations. UserID opendkim:opendkim

Solution 3:

For me it was a simple issue of using the wrong user name, confirm you are using right user [Service] User=tadeusz

then reload your SytemD sudo systemctl daemon-reload

Solution 4:

In my case I tried to use root as the User and Group.

I deleted:

User=root
Group=root