When you run systemctl in Ubuntu 22.04 and it shows degraded, it indicates that one or more system services have failed to start or are in an abnormal state.
- Service misconfiguration: If the configuration file of a system service is incorrect, the service may fail to start. For example, in a database service, if the connection port or password in the configuration file is wrong, the service won't be able to start properly.
- Resource constraints: Insufficient system resources like memory or disk space can lead to service failures. When the disk is almost full, logging services or applications that need to write data to disk may not function correctly.
- Software bugs: There could be bugs in the software itself. A new update to a service might introduce issues that cause it to crash or not start as expected.
- Dependency issues: Some services rely on other services or libraries. If a required dependency is missing or has a problem, the dependent service will not work.
You can use the following command to list the failed services:
This command will show you a list of all the services that are in a failed state.
Once you've identified the failed service, you can try the following steps:
- Restart the service: You can attempt to restart the failed service using the
systemctl restart command. For example, if the nginx service has failed, you can run:
sudo systemctl restart nginx
- Check the service logs: Use the
journalctl command to view the logs of the failed service. For instance, to view the logs of the nginx service:
- Edit the service configuration: If misconfiguration is the cause, you can edit the service's configuration file. After making changes, you need to reload the system manager configuration and restart the service. For example:
sudo systemctl daemon-reload
sudo systemctl restart nginx
By following these steps, you should be able to diagnose and fix the issues causing the degraded status.