Direct Answer / TL;DR
Failed systemd units almost always stem from a bad ExecStart path or permission (203/EXEC), an unmet dependency, or a crash loop hitting StartLimitBurst. Diagnose with systemctl status -l and journalctl -u -b -e on Ubuntu 24.04, Debian 12, and RHEL 9; fix the unit, run daemon-reload, restart, then reset-failed.
systemctl status .service -l --no-pager
nginx.service: Main process exited, code=exited, status=203/EXEC nginx.service: Failed with result 'exit-code'.
Core Architecture & Mechanics
systemd (PID 1) drives every unit through a compact state machine: load (vendor unit merged with drop-ins and generators) → dependency transaction → job execution → active, inactive, or failed. A unit’s live state is fully inspectable with systemctl show; four properties decode roughly 90% of incidents: ActiveState, Result, ExecMainCode, and ExecMainStatus.
On start, systemd forks a sandboxed child, applies namespace/UID/cgroup restrictions, then calls execve(). Failures before the daemon’s own main() runs are reported by systemd itself as code=exited with a status in the reserved 200–243 range. The dominant member is 203/EXEC: execve() returned ENOENT or EACCES — wrong ExecStart path (it must be absolute), missing interpreter named in a shebang, or a noexec mount. Normal application exits appear as status=N; deaths by signal appear as code=killed with the shell-style 128+N number (143 = SIGTERM, 137 = SIGKILL).
The Result namespace maps directly to root-cause families: exit-code (process returned nonzero), signal/core-dump (crash), oom-killed (systemd-oomd or kernel OOM action), timeout (TimeoutStartSec/TimeoutStopSec elapsed; default 90 s), start-limit (more than StartLimitBurst, default 5, restarts within StartLimitIntervalSec, default 10 s), watchdog (missed WatchdogSec keepalive), protocol (e.g. Type=notify never issued readiness via sd_notify()), and resources (fork/cgroup accounting errors).
Every unit lives in the cgroup v2 hierarchy at /sys/fs/cgroup/system.slice/<unit>.service/. KillMode=control-group (default) signals the entire subtree on stop and on expiration of WatchdogSec or a timeout — the classic reason a daemon exits cleanly on its own yet the unit still fails: orphaned children keep the cgroup non-empty. Crashes of the main process are captured by systemd-coredump.socket and indexed by coredumpctl.
journald (systemd-journald.service plus its .socket) consumes unit stdout/stderr, the kernel ring via /dev/kmsg, and syslog sockets, storing structured binary records. Each record carries PRIORITY, _PID, _COMM, MESSAGE_ID, and crucially _SYSTEMD_UNIT, which is what makes journalctl -u exact rather than grep-based. Records land under /run/log/journal/<machine-id>/ (volatile tmpfs, wiped at reboot) or /var/log/journal/<machine-id>/ (persistent). Storage=auto — the default in /etc/systemd/journald.conf — persists only if that directory exists at boot: Ubuntu, Debian, and RHEL ship it; Arch does not. ForwardToSyslog coexists with rsyslog on RHEL/Debian; journald rate limiting collapses floods into Suppressed N messages records, and on-disk policy is governed by SystemMaxUse/SystemKeepFree.
Two more states confuse triage: not-found (a leftover enablement symlink whose package was removed) and masked (the unit file is symlinked to /dev/null). Both are visible in systemctl --failed and systemctl list-unit-files --state=masked,not-found.
Complete Reference Table / Diagnostic Matrix
Verified against systemd 252 (Debian 12, RHEL 9), 255 (Ubuntu 24.04), and 256/257 (Arch). Placeholders are written as <unit>.
| Item / Code / Flag | Behavior | Common Cause / Use Case |
|---|---|---|
systemctl --failed |
Lists units in failed state for this boot | First triage step after any boot incident |
systemctl status <unit> -l -n 50 |
State, Result, ExecMainStatus, last 50 log lines | Single best first look; -l stops line truncation |
journalctl -u <unit> -b -e |
Unit-filtered log, end of current boot, catalog hints with -x |
Unit-scoped deep dive |
journalctl -b -1 -u <unit> |
Log of the previous boot | Post-reboot crash analysis; requires persistent journal |
journalctl -p 0..3 -b |
Filters emergency..err only | Host-wide severe-error sweep |
journalctl --grep 'pattern' |
PCRE2 match against MESSAGE | segfault, oom, timed out signatures |
journalctl -k |
Kernel messages only (from journal, plus dmesg) |
OOM killer, module, and hardware faults |
journalctl _PID=1234 / -t ident |
Structured field match | Filter by process or SyslogIdentifier |
journalctl -o verbose|json-pretty |
Prints all structured fields | Scripting and log export |
journalctl --list-boots |
Enumerates boot IDs and offsets | Select a boot for -b N |
systemctl show -p ExecMainCode,ExecMainStatus,Result,NRestarts <unit> |
Machine-readable exit data | Automated decoding of failure class |
Result=start-limit |
Unit exceeded restart rate limit | Crash loop; clear with reset-failed |
status=203/EXEC |
execve() failed in the pre-exec chain |
Path typo, missing interpreter, noexec, SELinux/AppArmor |
status=137 / code=killed status=9 |
SIGKILL (128+9) | Kernel OOM killer, systemd-oomd, KillMode timeout |
status=143 / SIGTERM |
Clean shutdown signal escalated to failure | Daemon mishandling Restart=on-failure semantics |
systemctl reset-failed [unit] |
Clears failed state and rate-limit counters | Run after fixing root cause; supervisor state only |
systemctl cat / edit <unit> |
Shows unit + drop-ins / edits drop-in atomically | Overrides; edit auto-runs daemon-reload |
systemd-delta |
Diffs all overrides against vendor files | Drift audit after package upgrades |
systemd-analyze verify <unit> |
Offline syntax/path validation | Pre-deploy check that catches 203/EXEC causes |
systemd-analyze critical-chain [unit] |
Slowest ordering chain | Ordering deadlocks and boot latency |
systemctl list-jobs |
Shows pending jobs | Stuck ‘A start job is running…’ boot hangs |
coredumpctl list|info |
Lists cores with backtrace metadata | SIGSEGV post-mortem (needs systemd-coredump) |
journalctl --disk-usage / --vacuum-size=500M / --vacuum-time=2weeks |
Size report / prune archived journals | Log disk pressure; deletion is irreversible — inspect first |
Multi-Distro Implementation Differences
Ubuntu / Debian
# systemd 255 (Ubuntu 24.04) / 252 (Debian 12); persistent journal is default
systemctl --failed --no-pager
systemctl status <unit>.service -l -n 50 --no-pager
sudo journalctl -u <unit>.service -b -e --no-pager
# Machine-readable failure record
systemctl show <unit>.service -p ActiveState,Result,ExecMainCode,ExecMainStatus,NRestarts
# Confirm persistence and journal policy
ls -ld /var/log/journal
grep -E '^(Storage|SystemMaxUse|ForwardToSyslog)' /etc/systemd/journald.conf
# Apply fixes and clear state
sudo systemctl daemon-reload
sudo systemctl restart <unit>.service
sudo systemctl reset-failed <unit>.service
RHEL / AlmaLinux / Rocky
# systemd 252; persistent journal + rsyslog forwarding by default
systemctl --failed
sudo journalctl -u <unit>.service -b -e --no-pager
# SELinux is the most common RHEL-specific root cause for 203/EXEC and
# 'Permission denied' inside units
getenforce
sudo ausearch -m AVC,USER_AVC -ts recent
sudo journalctl -t setroubleshoot -b --no-pager
# Relabel a hand-copied unit file (prints changes with -v)
sudo restorecon -v /etc/systemd/system/<unit>.service
Arch Linux
# systemd 256+; journal is VOLATILE by default — enable persistence:
sudo mkdir -p /var/log/journal
sudo systemd-tmpfiles --create --prefix /var/log/journal
# After pacman upgrades, unit .pacnew files may need merging, then:
sudo systemctl daemon-reload
systemd-analyze verify <unit>.service
systemd-analyze critical-chain <unit>.service
Alpine / Containers
# Alpine runs OpenRC — no systemd, no journald
rc-status --all
sudo rc-service <svc> status
sudo rc-service <svc> restart
rc-update show | grep -E 'boot|default'
# Startup logs via the OpenRC logger; app logs via busybox syslog/rsyslog
grep -E '^rc_logger' /etc/rc.conf
sudo tail -n 100 /var/log/messages
# In systemd-based container images, journalctl reads only that
# container's /run or mounted /var/log/journal — not the host's
Common Failure Modes & Troubleshooting Recipes
Read journal failure records in order: the Active: line carries Result:, the next lines carry the process exit data, and systemctl status appends the last 10 journal lines for that unit — enough to classify the failure before opening the full journal.
R1 — Instant death with status=203/EXEC. execve() failed before the daemon ever ran.
systemctl status <unit>.service -l -n 50 --no-pager
systemctl cat <unit>.service # effective ExecStart + drop-ins
systemd-analyze verify /etc/systemd/system/<unit>.service
# Dry-run reproduction: execute the exact command as the unit user
sudo -u <user> </abs/path/to/binary> --version
# Typical causes: path typo, missing package/interpreter (ENOENT on shebang),
# noexec mount: mount | grep noexec ; RHEL: ausearch -m AVC -ts recent
R2 — Crash loop tripping Result=start-limit. Journal shows Start request repeated too quickly. Only ever a symptom: the real failure is in the restarts before the limit hit.
journalctl -u <unit>.service -b --no-pager | tail -40
systemctl show <unit>.service -p Result,ExecMainStatus,NRestarts,StartLimitBurst,StartLimitIntervalUSec
# 1) Fix the crash cause (see R1/R3), then clear failed state + counters:
sudo systemctl reset-failed <unit>.service
Widen limits only after the root cause is fixed, via a drop-in:
sudo systemctl edit <unit>.service
# drop-in content:
[Unit]
StartLimitIntervalSec=60
StartLimitBurst=10
R3 — Death by signal: SIGSEGV, SIGKILL, OOM. Decode ExecMainStatus: 11 = SIGSEGV (analyze the core), 9 = SIGKILL (memory or forced kill).
systemctl show <unit>.service -p ExecMainCode,ExecMainStatus
# Segfault (137 vs 139): install systemd-coredump, then
sudo coredumpctl list
sudo coredumpctl info <PID>
# SIGKILL from kernel OOM or systemd-oomd:
journalctl -k -b --no-pager | grep -iE 'out of memory|oom-killer'
journalctl -b --no-pager | grep -i 'memory pressure'
sudo oomctl 2>/dev/null
R4 — Start/stop timeouts. timed out. Killing. in the journal with Result=timeout. Usually a Type mismatch: Type=forking with a broken PIDFile, or Type=notify where the binary never calls sd_notify() (→ protocol failure). Long but healthy startups can justify raising TimeoutStartSec.
journalctl -u <unit>.service -b --no-pager | grep -iE 'timed out|killing'
systemctl show <unit>.service -p Type,TimeoutStartUSec,TimeoutStopUSec,NotifyAccess,MainPID
systemctl list-jobs --no-pager # stuck job blocks all dependent units
# Orphaned children keeping the cgroup busy? Inspect
systemd-cgls | sed -n '/<unit>.service/,+15p'
R5 — Dependency and ordering failures. Dependency failed for … is inherited: another unit in the chain died. Follow the graph backwards.
journalctl -b --no-pager | grep -iE 'dependency failed|timed out'
systemctl list-dependencies --reverse <unit>.service
systemd-analyze critical-chain <unit>.service
# Classic trap: Wants=network-online.target with no wait-online provider active
systemctl status systemd-networkd-wait-online.service NetworkManager-wait-online.service
R6 — journalctl triage toolkit and disk pressure. Time-box and priority-filter first; vacuum only with evidence of need.
journalctl --list-boots
journalctl -b -1 -u <unit>.service --no-pager # previous boot
journalctl -u <unit>.service --since '2025-01-20 09:00' --until '2025-01-20 10:00'
journalctl -p 0..3 -b --no-pager # emerg..err only
journalctl --grep 'segfault|oom|timed out' -b --no-pager
journalctl -u <unit>.service -o verbose --no-pager | head -40
# Disk pressure — DESTRUCTIVE pruning below: always inspect size first
sudo journalctl --disk-usage
sudo ls -lh /var/log/journal/*/
sudo journalctl --rotate
sudo journalctl --vacuum-size=500M
sudo journalctl --vacuum-time=2weeks
Cap growth permanently in /etc/systemd/journald.conf with SystemMaxUse=500M and SystemKeepFree=1G, then sudo systemctl restart systemd-journald. For not-found orphans, remove the stale enablement symlink via sudo systemctl disable --now <unit>.service; for masked units confirm intent with sudo systemctl unmask <unit>.service.
Production Hardening & Safety Checklist
Safety Check: Never edit before systemctl cat <unit> — you must see merge order (vendor file, then /etc/systemd/system, then .d/*.conf drop-ins). Prefer systemctl edit for overrides: it is atomic and runs daemon-reload automatically. Run systemd-analyze verify before every restart; export evidence first (journalctl -u <unit> -b -o json > /tmp/<unit>.json) because reset-failed wipes the failure record and journal vacuuming deletes archived logs irreversibly — record journalctl --disk-usage output before pruning.
- Back up all custom units before batch changes (read-only operation):
sudo tar -C / -czf /root/systemd-units-$(date +%F).tar.gz etc/systemd/system - Validate the actual daemon config before restart, not just the unit:
nginx -t,named-checkconf,sshd -t. - After every unit change:
systemctl daemon-reload→restart→ verifysystemctl is-activeandsystemctl show -p Result. - Audit override drift quarterly with
systemd-delta --type=extendedand re-runsystemd-analyze verifyafter major upgrades. - Pin
SystemMaxUseand alert on journal disk usage instead of lettingSystemKeepFreesilently rotate history you may need for post-mortems. - On shared or multi-tenant hosts, check
systemd-oomdpolicy (ManagedOOMMemoryPressure=) before blaming application crashes — its kills recordResult=oom-killed.
Frequently Asked Edge Cases
Why does journalctl -u my.service show 'No entries' although the service logs output?
The journal was volatile (Storage=auto without /var/log/journal) and /run was wiped by reboot, or the unit writes to a file via StandardOutput=. Enable persistence with mkdir -p /var/log/journal plus systemd-tmpfiles --create --prefix /var/log/journal, then restart systemd-journald.
How do I read logs from the boot before the current one?
List boots with journalctl --list-boots, then run journalctl -b -1 -e -u nginx.service. History survives reboots only with persistent journals (default on Ubuntu 24.04, Debian 12, RHEL 9; must be enabled on Arch).
How do I clear 'Start request repeated too quickly' without disabling restart protection?
Fix the underlying crash, then run systemctl reset-failed nginx.service, which clears the failed state and resets the rate-limit counters. To widen the ceiling, set StartLimitIntervalSec=60 and StartLimitBurst=10 in the [Unit] section of a systemctl edit drop-in.