Systemd & Services

0%
Systemdsystemdsystemctlunittargetreloadrestartdaemon-reload

Systemd & Services

6 interactive questions

SystemdQuestion
systemdsystemctlunittargetreloadrestartdaemon-reload

`systemctl start` vs `enable`; `reload` vs `restart`?

Click to reveal answer
SystemdAnswer

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.

SystemdQuestion
systemdsystemctlunittargetreloadrestartdaemon-reload

You edited a unit file and nothing changed. Why?

Click to reveal answer
SystemdAnswer

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>.

SystemdQuestion
systemdsystemctlunittargetreloadrestartdaemon-reload

What is a systemd target?

Click to reveal answer
SystemdAnswer

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.

SystemdQuestion
systemdsystemctlunittargetreloadrestartdaemon-reload

How do you debug a service that won't start?

Click to reveal answer
SystemdAnswer
  1. 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.
SystemdQuestion
systemdsystemctlunittargetreloadrestartdaemon-reload

What is `systemd-analyze` and when do you use it?

Click to reveal answer
SystemdAnswer

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.

SystemdQuestion
systemdsystemctlunittargetreloadrestartdaemon-reload

Difference between `systemctl reload` and `systemctl restart`?

Click to reveal answer
SystemdAnswer

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.