Fix: Failed to start service, how to read systemctl status and journalctl
Job for x.service failed tells you only that the service did not start. The real reason is in systemctl status and journalctl -u: a bad config, a wrong path in ExecStart, a busy port, a missing user or file permissions.
Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
Failed to start myapp.service: Unit myapp.service not found.
myapp.service: Main process exited, code=exited, status=203/EXEC
myapp.service: Failed to determine user credentials: No such process
myapp.service: Start request repeated too quickly.
systemd started the service’s process and the process exited with an error, or systemd could not even launch it. The one-line message is a pointer, not the cause. The cause is always in two places: the unit’s status, which shows the last few log lines and the exit code, and the journal, which has the full output of the program.
Step 1: read the status and the journal
systemctl status myapp.service --no-pager -l
journalctl -u myapp.service -b --no-pager -n 100 # this boot, last 100 lines
journalctl -xeu myapp.service # with explanations, jump to end
systemctl cat myapp.service # the unit file actually in use
In the status output, look at Active: (failed, activating auto-restart), Process: with status=..., and the log lines at the bottom. The exit code narrows it down fast:
status=203/EXEC: the file inExecStart=does not exist, is not executable, or has a wrong interpreter path. Check it withls -land run it by hand.status=217/USERorFailed to determine user credentials: theUser=in the unit does not exist. Create it, or fix the name.status=226/NAMESPACE: a sandboxing option such asProtectSystem=,ReadWritePaths=or aWorkingDirectory=points at a path that does not exist.status=1/FAILURE,status=2, or other small numbers: the program itself started and exited with an error. Its own message is in the journal lines just above.Unit ... not found: the unit file is not in/etc/systemd/system/or you did not rundaemon-reloadafter creating it.Start request repeated too quickly: it is crashing in a loop;systemctl reset-failed myappafter you fix the cause, then start again.
Cause 1: the program's own configuration is broken
For well-known daemons the quickest check is the built-in config test; it prints the file and line number.
Check before you run this
- Runs with administrator rights. Make sure you understand every line.
sudo nginx -t
sudo apachectl configtest
sudo sshd -t
sudo postgres -D /var/lib/postgresql/16/main -C data_directory # or check postgresql.log
sudo haproxy -c -f /etc/haproxy/haproxy.cfg
Cause 2: a port is already in use or an address is missing
The journal shows bind() to 0.0.0.0:80 failed (98: Address already in use) or Cannot assign requested address. Find the holder with sudo ss -ltnp 'sport = :80' and stop it or move one of the two; see the Fix article on EADDRINUSE. Cannot assign requested address means the IP in the config is not configured on any interface.
Cause 3: wrong path, user or permissions in the unit
Check before you run this
- Runs with administrator rights. Make sure you understand every line.
# Run exactly what systemd runs, as the same user
sudo -u myapp /opt/myapp/bin/server --config /etc/myapp.toml
# Permission denied on a file or socket? Check ownership of what the service touches
ls -l /etc/myapp.toml /var/log/myapp /run/myapp
# Edit the unit safely with an override, then reload
sudo systemctl edit myapp.service
sudo systemctl daemon-reload
sudo systemctl restart myapp.service
Remember that a service has no PATH to speak of and no shell: ExecStart= needs an absolute path, cannot use ~, pipes or && unless you call /bin/sh -c '...', and does not read your .bashrc. Set variables with Environment= or EnvironmentFile=.
Cause 4: a dependency is not ready
An app that needs the network, a database or a mounted disk may start before it is available. After=network-online.target plus Wants=network-online.target waits for the network; After=postgresql.service orders it behind the database; RequiresMountsFor=/data waits for a mount. For flaky dependencies, Restart=on-failure and RestartSec=5 let it retry instead of failing once at boot.
Check that it is fixed
Check before you run this
- Runs with administrator rights. Make sure you understand every line.
sudo systemctl restart myapp.service
systemctl is-active myapp.service # active
systemctl status myapp.service # Active: active (running), no error lines
journalctl -u myapp.service -f # watch it for a minute
systemctl is-enabled myapp.service # enabled, so it comes back after a reboot
When it is not what you think
active (exited)is normal forType=oneshotunits and some init scripts; it is not a failure.Warning: The unit file ... changed on disk. Run 'systemctl daemon-reload'means systemd is still using the old version of the unit; your edit has not taken effect yet.- If the journal is empty for the service, logging may go to a file (
/var/log/myapp/) rather than stdout, or journald storage is volatile and the lines are from a previous boot: tryjournalctl -u myapp -b -1. - A unit that fails only at boot but starts fine by hand is almost always an ordering or dependency problem (Cause 4), not a configuration error.
Official documentation
Did this work for you?
No votes yet. Be the first.
If it did not work, the report form below tells the editors what went wrong.
See also
- 0164 systemd services: systemctl and journalctl basics systemd starts and supervises services on most Linux servers. systemctl starts, stops and enables them; journalctl shows their logs. Beginner · Explains an idea · Linux Article Services & systemd 15 Oct 2026
- 0165 Write a systemd service unit for your own app Turn any long-running program into a proper service: create a unit file, run it as an unprivileged user, restart it on failure… Intermediate · Step by step · Linux Article Services & systemd 15 Oct 2026
- 0166 Replace a cron job with a systemd timer A systemd timer runs a service on a schedule like cron, but logs every run to the journal, can catch up missed… Intermediate · Step by step · Linux Article Services & systemd 15 Oct 2026
- 0167 Fix: Job for nginx.service failed because the control process exited with error code systemctl prints this when a service's start command exits with an error. The real reason is in journalctl; for nginx it is… Intermediate · Fixes an error · Linux Article Networking & firewalls · Services & systemd 15 Oct 2026
- 0168 Server health check script: disk, memory and failed units A dependency-free bash script that checks disk and inode usage, available memory, load, failed systemd units and pending reboots, and exits non-zero… Intermediate · Cheat sheet · Linux Script Disks, LVM & filesystems · Services & systemd 15 Oct 2026
- 0193 Linux logs reference: journalctl, journald storage, logrotate and centralized logging Read and filter systemd journal logs, keep their disk use in check, rotate classic log files with logrotate, and understand when to… Intermediate · Cheat sheet · Linux Article Linux administration · Logs 15 Oct 2026
Repos in the wild
- systemd: the Linux system and service manager systemd/systemd The source of systemd, the init system and service manager on most Linux distributions, together with journald, networkd, resolved, timers and the systemctl tool. GitHub
- Loki: horizontally scalable log aggregation inspired by Prometheus grafana/loki The Grafana Loki repository: a log store that indexes labels instead of full text, queried with LogQL from Grafana or logcli, with the single-binary mode for one host and the microservices mode for clusters. GitHub
- Wazuh: an open source security platform with agents, SIEM and XDR wazuh/wazuh Wazuh installs a small agent on each server and sends its logs, file changes and package lists to a central manager that detects intrusions, checks configurations and reports vulnerabilities. GitHub
- Zeek: network security monitoring that turns traffic into logs zeek/zeek Zeek, formerly Bro, watches network traffic and writes structured logs of every connection, DNS query, HTTP request and certificate it sees. Analysts search those logs to understand what happened on the network. GitHub
History
Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.
- Dominik +5,155 chars