CompTIA Linux+ free question 10 / 10 · Domain 5: Troubleshooting
A service failed repeatedly until it reached its start rate limit, and systemd now refuses to start the unit again. Which systemctl command does the manual page describe for resetting both its failed state and its start rate limit counter?
- systemctl is-failed myapp.service
- systemctl is-active myapp.service
- systemctl list-units --failed
- systemctl reset-failed myapp.service
Show the answer and explanation
Answer: D
Why this is correct
The systemctl page says that reset-failed resets the failed state of the specified units, or of all units if no unit name is passed. A unit enters the failed state when a process exits with a non-zero code, terminates abnormally or times out, and the state stays until the unit is stopped, restarted or reset with this command. The command also resets the start rate limit counter of all unit types to zero.
Why the other options are wrong
"systemctl is-failed myapp.service" … The page describes is-failed as a check whether any of the specified units is in the failed state, with exit code 0 if at least one has failed. It reports the state and clears nothing.
"systemctl list-units --failed" … The page says that --failed lists units in the failed state and is equivalent to --state=failed. It shows which units failed and does not reset them.
"systemctl is-active myapp.service" … The page describes is-active as a check whether any of the specified units are active, that is running, with exit code 0 if at least one is active. It reads the state and changes none.
Key points
is-failed, is-active and --failed only read the state, and reset-failed changes it. The exit status of an is-failed check is 0 when at least one of the units has failed.
Go to the CompTIA Linux+ practice app (10 free questions; purchase unlocks all questions)