Skip to content

Diagnose a Failed Linux systemd Service

Admin
October 4, 2026
7 min read
Intermediate
💻 Target OS: Ubuntu 24.04+ / Debian 12+ / RHEL 9+

Before you begin

  • Applies to:Linux hosts where systemd manages the failing service.
  • Where to start:Open a shell on the affected host. Set the unit name in Step 1 and keep the same shell open for the remaining checks.
  • What you need:Have the exact unit name and sudo access for journal checks. For stateful services, follow the application's approved recovery and change procedures before retrying a start.
Guide tools
Guide tools
0/0 Steps (0%)

When a Linux service fails to start, systemctl shows its state and systemd records the service’s output and exit status in the journal. Follow the evidence from the failed unit to its recent logs, inspect the unit and its dependencies, then make a targeted correction and verify the recovery.

The examples use example.service; set the unit variable in Step 1 to the actual unit name and keep the same shell open. These steps inspect configuration before restarting anything. For databases, queues, and other stateful services, follow the application’s recovery and change procedures before repeating start attempts.


01

List Failed Units and Inspect the Target

Initial Check

Start with the failed-unit list, then check the specific service. The status output includes whether the unit is loaded, its active state, the process exit result, and a small amount of recent journal output. Save this information before resetting a failed state or making changes.

Terminal window
systemctl --failed
unit=example.service
systemctl status "$unit" --no-pager --full
❯ Illustrative Output (Results Vary)
● example.service - Example application
Loaded: loaded (/etc/systemd/system/example.service; enabled)
Active: failed (Result: exit-code)
Process: 1234 ExecStart=/opt/example/bin/server (code=exited, status=1/FAILURE)

02

Find the First Useful Error Message

Logs

Read this boot’s service log without a pager, then narrow it to the recent time window if needed. Look for the first application error before systemd’s final failure message; common causes include invalid configuration, unavailable dependencies, and permission errors.

What you should see · The journal identifies the earliest error tied to the failed start, such as a missing file or dependency.

If you see something else · If the current boot lacks the failure, check the incident time and retained logs. If you find the error, go to Step 3 and compare it with the unit settings before starting the service again.

Terminal window
sudo journalctl -b -u "$unit" --no-pager -n 100
sudo journalctl -u "$unit" --since "30 minutes ago" --no-pager
❯ Illustrative Output (Results Vary)
Oct 04 11:42:13 host server[1234]: Error: unable to read /etc/example/config.yml
Oct 04 11:42:13 host systemd[1]: example.service: Main process exited, code=exited, status=1/FAILURE
Linux terminal showing a failed systemd service and journal permission error

Figure 1: A failed unit’s status and journal identify a permission error reading its configuration file.


03

Check the Unit File, Overrides, and Dependencies

Configuration

systemctl cat shows the main unit and any drop-ins, while systemctl show reports selected effective properties. Confirm the executable path, user, working directory, environment files, and required units exist. Unit files installed by packages usually live under /usr/lib/systemd/system or /lib/systemd/system; local overrides generally belong under /etc/systemd/system.

Terminal window
systemctl cat "$unit"
systemctl show "$unit" \
-p FragmentPath -p DropInPaths -p User -p Group -p ExecStart -p WorkingDirectory
systemctl list-dependencies "$unit"
❯ Illustrative Output (Results Vary)
FragmentPath=/usr/lib/systemd/system/example.service
User=example
ExecStart={ path=/opt/example/bin/server ; argv[]=/opt/example/bin/server ... }

04

Check Unit Syntax and Application Inputs

Validation

After correcting a specific issue, validate the unit file if your systemd version provides systemd-analyze verify. Separately run the application’s own configuration check when available; unit syntax validation cannot confirm that the application config, credentials, network dependencies, or data are correct. If a unit file changed, reload systemd’s unit definitions before trying to start the service.

Terminal window
sudo systemd-analyze verify "$unit"
# Run the application's documented config-check command here, if available.
sudo systemctl daemon-reload
❯ Illustrative Output (Results Vary)
No unit-file errors reported.

05

Retry Once and Review the New Logs

Recovery

Once the cause has been corrected, start the unit and check its state and newest journal entries. Confirm the application is actually serving its expected function; an active systemd state only confirms that the process is running according to the unit. Avoid repeated restarts when the service is failing on persistent data or a dependency that remains unavailable.

Terminal window
sudo systemctl start "$unit"
systemctl is-active "$unit"
systemctl status "$unit" --no-pager --full
sudo journalctl -u "$unit" --since "5 minutes ago" --no-pager
❯ Illustrative Output (Results Vary)
active
Active: active (running)

For more detail, see the systemd project’s debugging guide and the systemctl manual.

Comments