Debug Linux With Systemctl
This is a short trip where I have debugged some issues with systemctl
on my Arch.
Issues
My system was not stable as it used to be. It will not proper shutdown/suspend at random times. I have to force shutdown by holding the power button. Eventually I think about checking the systemctl
.
Debug flow
Listing global system status
systemctl status
# State: degraded
Listing failed units
systemctl list-units --state=failed
In my case I see open-fprintd-resume.service
, open-fprintd-suspend.service
and open-fprintd.service
was failed.
This reminds me that my system was originally installed on my Laptop with fingerprint reader. But later I have migrated to Desktop with the same SSD.
Further investigation on the failed units
journalctl -xeu open-fprintd-resume.service
-xe
: These are options passed to thejournalctl
command:-x
or--catalog
: This option enables the extended output format, which provides additional information such as human-readable descriptions of log fields.-e
or--pager-end
: This option tellsjournalctl
to start at the end of the logs and display the most recent entries first. It’s useful for quickly viewing the latest log entries and any recent errors or warnings.
-u open-fprintd-resume.service
: This specifies the unit whose logs you want to view. In this case,open-fprintd-resume.service
is the name of the systemd service unit. By specifying this unit,journalctl
will only display logs related to this particular service.
Resolve depends on your cases. In my case I have removed python-validity
package as it was causing the issue.
yay -Rs python-validity
Finally reset the failed units
systemctl reset-failed
Recheck the status
systemctl status
# State: running