Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
InfrastructureMiddleOccasionalTroubleshooting

How do you check and troubleshoot a systemd service on Linux?

Answer

Start with `systemctl status <unit>` to inspect the unit state and recent messages. Use `systemctl start`, `stop` or `restart` only when appropriate, and use `journalctl -u <unit>` for service logs. Also distinguish `enable`, which affects start-at-boot configuration, from `start`, which changes the current runtime state.

Strong answer includes

  • systemctl status before blindly restarting
  • journalctl -u for unit logs
  • distinguishes start from enable

Practical example

If `api.service` is down after deployment, `systemctl status api.service` may reveal an exit code, and `journalctl -u api.service -n 100 --no-pager` provides the startup error without restarting away useful evidence.

#linux#systemd#services#journalctl

Sources

systemd manualsystemd project · systemctl, journalctl, service units and systemd operational behavior50 Linux Interview Questions (With Answers)Toolmingo · Recurrence signal for Linux filesystem, permissions, processes, systemd, networking and shell-command interview topics