Systemd & Services
Systemd & Services
6 interactive questions
`systemctl start` vs `enable`; `reload` vs `restart`?
start runs it now; enable makes it start at boot — independent, so you usually want enable --now. reload re-reads config without dropping connections (if the daemon supports it); restart stops and starts with brief downtime. ⚠️ A service can be running but not enabled → it vanishes after reboot.
You edited a unit file and nothing changed. Why?
You didn't run systemctl daemon-reload, so systemd is still using the cached unit. ⚠️ Always daemon-reload after editing a unit, then restart. Verify the effective unit with systemctl cat <unit>.
What is a systemd target?
A target is a group of units to reach a desired state (like runlevels). Common: multi-user.target (text mode), graphical.target (GUI), default.target (symlink to one of the above). systemctl isolate <target> switches state.
How do you debug a service that won't start?
systemctl status <unit>— recent logs + exit code. 2.journalctl -u <unit> -xe— full log. 3.systemctl cat <unit>— effective config. 4. Check dependencies:systemctl list-dependencies <unit>. 5. Run the binary manually with same env to see stderr.
What is `systemd-analyze` and when do you use it?
Boot performance profiler. systemd-analyze total boot time; systemd-analyze blame per-unit time; systemd-analyze critical-chain dependency graph. Use to find slow services delaying boot.
Difference between `systemctl reload` and `systemctl restart`?
reload tells the daemon to re-read config (SIGHUP) without dropping connections; restart stops then starts (SIGTERM → SIGKILL → start). Use reload for config changes when supported; restart for binary updates or when reload isn't implemented.