Back to lessons

Hosting Operations

Check Failed Dependencies for a Service

A service fails after startup, but the real blocker may be a dependent unit such as Redis, networking, a mount, or a socket.

Command

systemctl list-dependencies app-worker --failed --no-pager

What changed

Nothing changes. systemctl prints failed dependencies for the requested unit.

Danger

safe

When to use it

Use when a service failure mentions connection refused, missing mounts, network targets, sockets, or required local services.

When not to use it

Do not assume every dependency failure is causal; inspect the dependency logs and timeline.

Undo or recovery

No undo needed because the command is read-only.

Expected output

A dependency tree containing failed units under the target service.

demo script

Disposable terminal steps

  1. systemctl list-dependencies app-worker --failed --no-pager
  2. journalctl -u redis -b --no-pager -n 30

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ systemctl list-dependencies app-worker --failed --no-pager
app-worker.service
● ├─redis.service
● └─network-online.target
::exit-code::0
$ journalctl -u redis -b --no-pager -n 30
Jun 25 14:19:40 vps systemd[1]: Starting redis.service - Redis data store...
Jun 25 14:19:41 vps redis-server[1998]: Fatal error, can't open config file '/etc/redis/redis.conf': Permission denied
Jun 25 14:19:41 vps systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Jun 25 14:19:41 vps systemd[1]: redis.service: Failed with result 'exit-code'.
::exit-code::0

YouTube Short

Check failed dependencies.

A failed app service may only be reporting that Redis, a mount, or networking is broken. Ask systemd for failed dependencies.

LinkedIn hook

Sometimes the service is only the messenger for a failed dependency.

Question: How often is a failed service actually a failed dependency?

experiments

A/B tests to run

Metric: average_view_duration

A: The service may be the messenger.

B: Find the failed dependency first.