How to List and Troubleshoot Failed Services in Ubuntu Using systemctl

When an Ubuntu server or desktop completes its startup sequence, dozens of systemd background units initialise in parallel to establish network interfaces, mount filesystems, launch web servers, and manage security daemons. If a configuration syntax error, missing dependency, or permission conflict occurs during boot, systemd marks the unit as failed. When logging in via SSH, you may see a warning: System status: degraded.

Rather than scrolling through thousands of journal entries manually, you can quickly filter and diagnose broken units using systemctl and targeted journalctl diagnostics in Ubuntu.

Listing All Currently Failed systemd Units

To display an instant summary of every service that aborted or crashed on your system:

systemctl --failed

The terminal outputs a clean, tabular report listing each broken unit:

  UNIT             LOAD   ACTIVE SUB    DESCRIPTION
● apache2.service  loaded failed failed The Apache HTTP Server
● redis.service    loaded failed failed Redis In-Memory Data Store

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state.
SUB    = The low-level unit activation state.

2 loaded units listed.

Inspecting Service Status and Exit Codes

Once you identify a failed service, inspect its runtime state and termination code:

systemctl status apache2.service

Pay close attention to these key indicators:

  • Process: Shows the exact command line executed and the exit status (for example, code=exited, status=1/FAILURE).
  • Active: Indicates whether the failure occurred during startup (failed (Result: exit-code)) or timeout (failed (Result: timeout)).

Reading Real-Time Failure Logs with journalctl

The status command only shows the last few log lines. To view the complete context and specific error messages produced by the failed daemon during its last execution:

sudo journalctl -u apache2.service -e --no-pager

The -e flag jumps directly to the end of the log buffer, revealing exact error messages such as missing SSL certificates, syntax errors in virtual host files, or database socket connection refusals.

Resetting Failed State After Resolving Issues

Once you correct the underlying configuration error or restore the missing file, restart the service and clear its degraded status:

sudo systemctl restart apache2.service
sudo systemctl reset-failed

Run systemctl --failed again to confirm that 0 loaded units listed is displayed and system health is fully restored.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.