How to List and Diagnose Failed systemd Services with systemctl
This guide explains how to use systemctl and journalctl on CentOS 7 to list services that failed to start, check individual service status, interpret error messages, and filter logs for troubleshooting, providing concrete command examples and output analysis.
Listing Failed systemd Units
The systemctl list-units --state failed command displays all units whose state is failed . The output columns are:
UNIT : unit name (e.g., httpd.service)
LOAD : whether the unit definition was loaded
ACTIVE : high‑level activation state
SUB : low‑level activation state, varies by unit type
DESCRIPTION : human‑readable description
[root@localhost ~]# systemctl list-units --state failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● httpd.service loaded failed failed The Apache HTTP Server
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high‑level unit activation state.
SUB = The low‑level unit activation state.
1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.Checking a Specific Service with is-failed
The systemctl is-failed <unit> option returns failed if the service did not start, otherwise active:
[root@localhost ~]# systemctl is-failed httpd
failed
[root@localhost ~]# systemctl is-failed vsftpd
activeViewing Detailed Failure Reason
Use systemctl status <unit> to see why a service failed. In the example, the Apache HTTP Server fails because of a syntax error in /etc/httpd/conf/httpd.conf on line 354:
May 26 09:22:05 localhost httpd[2958]: httpd: Syntax error on line 354 of /etc/httpd/conf/httpd.conf: ...Inspecting Logs with journalctl
If systemctl status does not reveal the cause, journalctl can be used to view the full journal. Filtering for the word error helps locate relevant entries:
[root@localhost ~]# journalctl | grep 'error'
May 26 09:22:05 localhost httpd[2958]: httpd: Syntax error on line 354 of /etc/httpd/conf/httpd.conf: ...To view logs for a single unit, use the -u option:
[root@localhost ~]# journalctl -u httpd.service
-- Logs begin at Sun 2020-05-24 06:52:52 CST, end at Tue 2020-05-26 09:48:03 CST.
... (log entries showing the same syntax error) ...Summary
We learned how to list failed services, check individual service states, examine detailed failure reasons with systemctl status, and dig into the system journal using journalctl to troubleshoot startup problems on Linux.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
