How to verify a systemd unit for errors?
How to verify a systemd unit for errors?
Run the systemd-analyze command with the 'verify' subcommand, followed by the unit file.
systemd-analyze verify UNITSystemd has a set of utilities available to monitor the state of units. One of the systemd commands is systemd-analyze that may help with troubleshooting issues, such as errors in unit files.
Testing with systemd-analyze
Run the systemd-analyze command with the verify subcommand, followed by the unit itself.
No errors
# systemd-analyze verify ssh.service
When there are no issues, the output remains empty.
Assignment outside of section
/etc/systemd/system/apparmor.service.d/override.conf:1: Assignment outside of section. Ignoring.
This error indicates that a change has been made, but not inside a section, such as the ‘[Service]’ block.
Unknown key
/etc/systemd/system/apparmor.service.d/override.conf:2: Unknown key 'Befored' in section [Service], ignoring.
When an unknown or invalid setting has been specified, systemd-analyze will show this as a unknown key.