BeginnerPhone
2 min
systemd Service Basics
LinuxSystem AdministrationInit Systems
Advertisement
Interview Question
How do you check, start, and enable a service with systemd, and where are unit files located?
Key Points to Cover
- `systemctl status|start|stop|restart <svc>`; `enable` for boot
- Unit files typically in /etc/systemd/system and /lib/systemd/system
- `journalctl -u <svc>` to view logs
Evaluation Rubric
Lists core systemctl operations40% weight
Mentions unit file locations30% weight
Includes journalctl for logs30% weight
Hints
- 💡Daemon-reload after editing unit files.
Common Pitfalls to Avoid
- ⚠️Forgetting to use `sudo` when executing `systemctl` commands that modify system state.
- ⚠️Confusing `systemctl start` (manual start) with `systemctl enable` (configure for boot).
- ⚠️Not checking `journalctl -u <service_name>` immediately when a service fails to start or behaves unexpectedly.
- ⚠️Modifying unit files without running `systemctl daemon-reload` to inform systemd of the changes.
- ⚠️Not understanding the unit file precedence, particularly that `/etc/systemd/system` overrides `/usr/lib/systemd/system`.
Potential Follow-up Questions
- ❓Difference between enable and start?
- ❓How to add environment vars to a service?
Advertisement