Service lifecycle and enablement
Separate active state from boot-time enablement.
systemctl status
25 min read, 30 min lab
operator
`systemctl start` changes current runtime state. `enable` changes whether a unit starts at boot. `status` is a snapshot; pair it with journal output and unit file inspection when troubleshooting.
A service is running now but does not survive reboot.
Worked command
$ systemctl status ssh.service$ systemctl is-enabled ssh.service$ systemctl list-unit-files 'ssh*'$ sudo systemctl enable --now ssh.service
Do not assume active means enabled or enabled means healthy.
Check active, enabled, logs, and unit file path separately.
`systemctl status ssh` shows active (running) but the service is gone after every reboot. What does this tell you?
Show the answer
Correct: A. It is active now but not enabled, so it won't start at boot
Active is runtime state; enable controls boot-time start. Run `systemctl is-enabled ssh` and `enable --now` to persist it. The 'crashing on boot' guess assumes it tries to start at boot at all, but a disabled unit is never invoked.
Practice checklist
- Inspect a harmless service.
- Record active and enabled state.
- Find recent unit logs.
Deliverable evidence
- A service state table: active, enabled, recent logs, unit path.
shows: Active, enabled, logs, and unit-file are four independent questions, and that a unit edit needs daemon-reload before systemd acts on it.
does not prove: It shows which checks to run, not their results: a green "active" box is a snapshot, not proof the service is healthy or will survive the next reboot.
Commit these to memory, then drill them until recall is automatic.
cue Service runs now but does not survive reboot: make it start at boot and right now
show recall target
sudo systemctl enable --now <unit>