How to Use systemctl to Show Failed Units

The systemd is the default init system of all modern Linux distributions that comes with a command line utility called systemctl. It is used to manage systemd Units and is also a key method to check the status of the unit. In the tutorial, I will be covering how to list the failed units on Linux and how to fix them.

How to Show Failed Units on Linux using systemctl Command

On Linux, the unit often failed due to various reasons, such as due to:

  • Missing dependencies
  • Incorrect configurations
  • Corrupt files
  • Lack of system resources
  • Lack of required permissions

To resolve the issue, we must find out the failed units by listing them.

To list the failed units on Linux, use the systemctl, with the list-units command. Next, set the state of the unit as failed, using the –state option.

systemctl list-units –state=failed

The output shows that myservice unit has loaded but failed. Another method to check whether a unit has failed to activate or not, use the following command.

systemctl is-failed [Unit-Name]

Or, you can directory check the status of a unit with log after boot.

systemctl status [Unit-Name]

The grep command can also be used with systemctl to list the failed units.

systemctl list-units | grep -i failed

How to Fix Failed Units on Linux

To fix all the failed units on Linux, the reset-failed command is used with systemctl.

sudo systemctl reset-failed

To fix a specific failed unit on Linux, mention the service or unit name after the reset-failed command.

sudo systemctl reset-failed [Unit-Name]

The above command will not display any output. The status option with the unit’s name lets you know if the service is running or not.

systemctl status [Unit-Name]

It can be seen that the service is no longer in a failed state. But it is loaded and inactive state. To activate the unit, we need to start it and for that use the sudo systemctl start with the unit’s name. After starting it, check the status of the unit.

It’s also worth noting that service failures are caused by a variety of elements. If there is an abnormality in starting the unit or the unit gets timed out, the reset-failed will reset the unit and fix it. If you are missing the required dependencies, then only installing the dependency will fix the unit. Moreover, if there is some issue with the configuration file then reset-failed would not rectify it as it has to be dealt with manually.

How to Troubleshoot the Failed Units

If the service is still unable to get rid of the failed state, then you need to further troubleshoot it. To diagnose the problem, it is best practice to view the log messages of the unit.

To view the log of the unit, the systemd provides a built-in utility called journalctl. To view the log of a specific unit, use the command given below:

journalctl -u [Unit-Name] -xe

In the above command, the -x flag is used to display the complete catalog, and -e is used to show the last entry.

So, to further investigate the cause of the failed unit, we can view the errors in the log file.


On Linux, the unit fails due to various reasons, some common reasons are incorrect configuration or abnormal start-up of the service. To debug the unit’s failure, first, we have to list them using systemctl lits-units by mentioning the failed state. Then to further troubleshoot, status and log messages can also be checked. In order to fix the failed status of the service, use the systemctl reset-failed command, which resets the failed state of the unit in case of temporary abnormality. However, to know the exact cause of a failed unit, the unit’s log message can provide useful information.


Leave a Comment