Jump to content

How to Fix systemctl status Showing Degraded State


Linux Hint

Recommended Posts

Degraded is the system state on Linux, which indicates that the system is running but failed to load some services. This state can occur in any Linux distribution using systemd as an init system.

In this tutorial, I will walk you through how to view the system state using systemctl and how to fix it if it shows degraded.

Why is systemctl status Showing System State Degraded?

The systemctl has the status option to check the runtime status of a service or the entire system if no service name is mentioned.

An alternative method employed to verify the operational status of the system is known as is-system-running. This option checks the system state and returns a string based on the exit code. For example, if the system is fully operational, the output will be running with exit code 0. Any exit code greater than 0 indicates the system needs troubleshooting.

To check the system’s current state, use the systemctl status command.

systemctl status

word-image-413513-1.png

Or use the is-system-running option with systemctl.

systemctl is-system-running

word-image-413513-2.png

The above commands indicate that the system state is degraded, which means the system is operational but one or more services have failed to load.

Other common states that the above command can display are listed in the table given below:

initialization System state before boot when the basic.target run level is achieved or maintenance state is entered
starting System state after boot when the rescue.target run level is achieved or the jobs queue becomes idle
stopping The system is shutting down
running System state in which it is fully operational
degraded System state in which it is operational but one or more services are failed to load
maintenance The rescue or emergency target is enabled
offline The system manager is not running because an incompatible service manager is running as PID 1
unknown The state cannot be determined due to resource limitations

How to Fix System Degraded State?

As mentioned earlier, the degraded state indicates that one or more services have failed to load. Begin the troubleshooting process by identifying the failed services using systemctl.

systemctl list-units --state=failed

word-image-413513-3.png

The next step is to use the reset-failed option with the systemctl command to fix it.

systemctl reset-failed

The reset-failed option essentially resets the services that failed to run due to abnormal operation. However, this command does not guarantee that all the failed services will be enabled. The service can fail due to incorrect configuration of the service files, which are present in the /lib/system/system or /etc/systemd/system directories.

To learn more about the failed service, read the log messages. To access the log message of a service, use the journalctl command, -u flag, and service name.

journalctl -u [Service-Name]

In order to get an in-depth explanation of the log, use the -x option with -e. The -x flag displays explanatory help text, while the -e option shows the newest entry first.

journalctl -u [Service-Name] -xe

word-image-413513-4.png

Conclusion

The degraded is the system state which indicates that the system is running but one or more services have failed to load. This system state can be obtained using the systemctl status or systemctl is-system-running commands. The systemctl reset-failed command may resolve some problems, including degraded error, but it doesn’t guarantee the resolution of the issue. If the approach mentioned previously fails to resolve the issue, locate the issue by examining the logs using the journalctl command.

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...