Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

systemd refuses to start gunicorn because the User= account does not exist

Errorgunicorn.service: Failed to determine user credentials: No such process

Short answer

systemd looks up the User= and Group= names from your unit before it starts gunicorn. If either name does not exist on the server, the service fails with this error and gunicorn never runs. Check the names with id and getent, correct the unit or create the account, then reload systemd.

  • Applies to systemd 255, gunicorn 23, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the user and group the unit asks for, then check that the system knows both.

    systemctl cat gunicorn.service | grep -E '^(User|Group)='
    id deploy
    getent group www-data
  2. 2Match what you see, then jump to its fix

    1. 1id prints 'no such user', or getent group prints nothingThe user or group named in the unit does not existFix
    2. 2The User= name appears nowhere in getent passwdNo dedicated account was ever created for the serviceFix

What does the error look like?

  • gunicorn.service: Failed to determine user credentials: No such process

Cause 1 of 2

The user or group named in the unit does not exist

1Check

systemd documents that the name given to User= and Group= must already exist unless DynamicUser= is used. A typo, a user created on another server, or a group such as www-data that this distro does not have all fail the same way.

systemctl cat gunicorn.service | grep -E '^(User|Group)='
getent passwd deploy
getent group www-data

2Fix

Change User= and Group= to an account that exists, or create the account, then reload systemd and restart.

sudo useradd --system --create-home deploy
sudo systemctl daemon-reload
sudo systemctl restart gunicorn

3Verify

The service is active and its status shows no credential error.

systemctl status gunicorn --no-pager

Confirmed by freedesktop.org

Did this fix it?

Cause 2 of 2

No dedicated account was ever created for the service

1Check

If you do not want to manage a real login account for gunicorn, systemd can allocate a temporary one. The man page describes DynamicUser= as allocating a user and group pair when the unit starts and releasing them when it stops.

systemctl cat gunicorn.service

2Fix

Replace User= and Group= with DynamicUser=yes. Directories the service must write to, such as a socket folder, can come from RuntimeDirectory=, which systemd creates under /run.

[Service]
DynamicUser=yes
RuntimeDirectory=gunicorn

3Verify

Reload systemd, restart, and check the status.

sudo systemctl daemon-reload
sudo systemctl restart gunicorn
systemctl status gunicorn --no-pager

Confirmed by freedesktop.org

Did this fix it?

How do I stop it coming back?

  • Create the service account in the same script that writes the unit file.
  • Run systemctl daemon-reload after every unit edit.
  • Keep User= and Group= identical across staging and production units.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.