systemd, Explained for People Who Just Want Their Service to Start
The init system that runs most Linux machines is less mysterious than it looks.
If you administer a Linux server, you will meet systemd within minutes, and it has a reputation for being sprawling and complicated. Most of that reputation comes from its breadth rather than its difficulty. For the common task of running a service reliably, you only need to understand a few concepts.
What systemd does
systemd is the first process the kernel starts, and it is responsible for bringing the rest of the system up: mounting filesystems, starting services in the right order, and keeping them running. It also handles logging and provides tools to inspect what is happening. Because it manages so much, learning it pays off across every Linux machine you touch.
Units are the core concept
Everything systemd manages is described by a unit. The most common type is a service unit, which describes a program to run: what command to execute, what to do if it crashes, and what must be running before it starts. Units are plain text files, which means your service configuration is readable, version-controllable and easy to share.
A minimal service, conceptually
- What to run: the command and its arguments.
- When to run it: what the service depends on and when it should start during boot.
- What on failure: whether to restart automatically, and how often.
The commands you will actually use
Day to day, you interact with systemd through two tools. One starts, stops, enables and checks the status of services; "enable" means start automatically at boot, which is separate from starting it right now. The other reads the logs, letting you filter by service and follow output live. Between them they cover the vast majority of real work.
Why the logging matters
systemd captures the output of the services it manages into a central journal. That means when a service fails, you do not have to hunt for a log file; you ask systemd what that unit has been saying. Being comfortable reading the journal is the single most useful skill for diagnosing a service that will not start.
Dependencies and ordering, without the folklore
A lot of systemd confusion comes from mixing up two separate ideas: whether one service requires another, and what order they start in. Requiring a service means it should be pulled in when yours is; ordering means yours should wait until another is up first. They are independent, and stating both explicitly is what makes boot behaviour predictable. When a service starts too early and fails because something it needs is not ready, the fix is almost always an ordering statement, not a timer or a sleep hacked into the startup command.
Timers are the modern replacement for cron
If you have scheduled jobs, systemd offers timer units as an alternative to the traditional cron scheduler. The advantage is that a scheduled task becomes a normal service, so its output lands in the same journal, its failures are visible through the same status tools, and it can declare the same dependencies as anything else. For anything that has to run on a schedule and matter if it fails, a timer paired with a service is easier to observe than a line hidden in a crontab.
A repeatable way to debug a failed service
When a service refuses to start, a consistent routine saves a lot of guesswork. First check its status, which shows whether it is loaded, enabled and what its most recent exit looked like. Then read its journal, which collects the program's own output alongside systemd's account of what it tried to do. Nine times out of ten the answer is right there: a missing file, a permission error, or a dependency that was not ready. Resisting the urge to randomly restart and instead reading what the system is plainly telling you is the habit that turns systemd from frustrating into predictable.
The bottom line
systemd is large, but the part you need for running services is small and consistent. Learn what a unit is, how to enable and check a service, and how to read its logs, and the mystery mostly disappears. The same knowledge applies to nearly every modern Linux system you will manage.
Written by
Kwame BoatengSecurity researcher and Linux enthusiast writing about privacy and infrastructure.
0 Comments
Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.