systemd refuses to start gunicorn because the User= account does not exist
gunicorn.service: Failed to determine user credentials: No such processShort 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.
Fix it fast
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-data2Match what you see, then jump to its fix
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-data2Fix
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 gunicorn3Verify
The service is active and its status shows no credential error.
systemctl status gunicorn --no-pagerConfirmed by freedesktop.org
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.service2Fix
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=gunicorn3Verify
Reload systemd, restart, and check the status.
sudo systemctl daemon-reload
sudo systemctl restart gunicorn
systemctl status gunicorn --no-pagerConfirmed by freedesktop.org
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 fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Apache warns that a ${VAR} config variable is not defined
${VAR} left unchanged in the configuration, with a warning in the error log
Apache expands ${VAR} from Define or from the shell environment that exists when the server starts.
3 causes, each with a fix