Back to lessons

Linux Survival Basics

Read the Failure Cause in systemctl Status

A systemd service is failed and you need the active state, exit status, unit paths, and the most recent failure lines in one read-only check.

Command

systemctl status app-worker --no-pager --lines=50

What changed

Nothing changes. systemctl prints service metadata, process exit status, and recent journal lines.

Danger

safe

When to use it

Use first when a specific service is failed and you need a fast summary before deeper journal or unit-file inspection.

When not to use it

Do not stop at status when the failure is intermittent, old, or missing context; follow up with journalctl and systemctl show.

Undo or recovery

No undo needed because the command is read-only.

Expected output

A failed active state, Result value, ExecStart exit status, and recent lines showing the failing startup step.

demo script

Disposable terminal steps

  1. systemctl --failed --no-pager
  2. systemctl status app-worker --no-pager --lines=50

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ systemctl --failed --no-pager
  UNIT               LOAD   ACTIVE SUB    DESCRIPTION
  app-worker.service loaded failed failed Background job worker
  api.service        loaded failed failed Example API service
2 loaded units listed.
::exit-code::0
$ systemctl status app-worker --no-pager --lines=50
● app-worker.service - Background job worker
     Loaded: loaded (/etc/systemd/system/app-worker.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/app-worker.service.d
             └─override.conf
     Active: failed (Result: exit-code) since Thu 2026-06-25 14:22:17 CDT; 4min ago
   Duration: 1.243s
    Process: 2144 ExecStart=/srv/app/bin/worker --queue default (code=exited, status=217/USER)
   Main PID: 2144 (code=exited, status=217/USER)
        CPU: 38ms

Jun 25 14:22:17 vps systemd[1]: Started app-worker.service - Background job worker.
Jun 25 14:22:17 vps systemd[2144]: app-worker.service: Failed to determine user credentials: No such process
Jun 25 14:22:17 vps systemd[2144]: app-worker.service: Failed at step USER spawning /srv/app/bin/worker: No such process
Jun 25 14:22:17 vps systemd[1]: app-worker.service: Main process exited, code=exited, status=217/USER
Jun 25 14:22:17 vps systemd[1]: app-worker.service: Failed with result 'exit-code'.
::exit-code::0

YouTube Short

Start with the failed service status.

When a unit is failed, status gives the state, result, exit code, and the newest journal lines in one screen.

LinkedIn hook

The status page often tells you the failed startup step before you open every log.

Question: When a service fails, do you read systemctl status before opening the full journal?

experiments

A/B tests to run

Metric: save_rate

A: Status often names the failed startup step.

B: One screen before full log digging.