6

Systemd Service Not Starting (status=217/USER)

 1 year ago
source link: https://www.shellhacks.com/systemd-service-not-starting-status217-user/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Systemd Service Not Starting (status=217/USER)

A systemd service may fail to start with the error:

Main process exited, code=exited, status=217/USER

The status=217/USER indicates that the user that is configured to run the service could not be found.

This could happen if there is a typo in a username or you have copied a service file from another machine and it contains the user that doesn’t exists on your system.

This also could happen if the user that should run the service is not the local one but comes from some external authentication provider, like LDAP or Active Directory.

This short note shows how to fix the “Main process exited, code=exited, status=217/USER” error for such external user.

Cool Tip: Display systemd service logs using the journalctl command! Read More →

Main process exited, code=exited, status=217/USER

If the systemd service should be run as the user from external authentication provider, it could happen that it is started before the connection to LDAP or Active Directory server is established.

In this case you will get the “Main process exited, code=exited, status=217/USER” error.

To solve this issue you can delay the service startup by configuring it to start after the multi-user.target:

# /etc/systemd/system/foo-daemon.service

[Unit]
After=network.target multi-user.target
...

The multi-user.target means that the systemd service will start after everything that is needed for full system functionality is started (including the connection to external authentication providers).

Cool Tip: Systemd service file examples! Read More →

The update of the systemd service file as shown above followed by system reboot should fix the “Main process exited, code=exited, status=217/USER” error.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK