5

I've just had to diagnose a fault that turned out to be because someone had edited a systemd definition (*.service) file and left an error behind. The result was that the service did not show up as failed but also did not run so my question is:

Is there a way to list all systemd units that have service definition errors?

As an example, here is the status of the job that failed:

localhost:~# systemctl status -l custom
● custom.service - Custom script
   Loaded: loaded (/usr/lib/systemd/system/custom.service; disabled; vendor 
preset: disabled)
   Active: inactive (dead)

Sep 12 16:00:25 localhost.localdomain systemd[1]: 
[/usr/lib/systemd/system/custom.service:20] Unknown section 'Path'. Ignoring.

I've tried listing dead services but there are many of them and most seem to be correct but just ended - what I want is to find the ones that have genuine errors such as this one.

3
  • 4
    systemd-analyze verify ... will do some checks. see man systemd-analyze. Commented Sep 13, 2018 at 12:07
  • It is a little verbose but that's certainly good enough for what I want - thanks. Commented Sep 13, 2018 at 14:15
  • I am turning @meuh ’s answer into an answer, because, well, it is one. Commented Nov 20, 2020 at 17:26

1 Answer 1

2

systemd-analyze verify … will do some checks.

see man systemd-analyze for options.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.