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.
Or use the is-system-running option with systemctl.
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.
The next step is to use the reset-failed option with the systemctl command to fix it.
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.
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.
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.