systemd is 10 years old, but feelings about it in the Linux community haven’t mellowed—it’s as divisive now as it ever was. Although it’s used by many major Linux distributions, the hardcore opposition hasn’t relented.
The Linux Boot Sequence
When you power on your computer, the hardware boots, and then (according to the type of boot sector your computer uses) either the master boot record (MBR) executes or the Unified Extensible Firmware Interface (UEFI) runs. The last action of both of these is to fire up the Linux kernel.
The kernel is loaded into memory, decompresses itself, and initializes. A temporary file system is created in RAM, usually by a utility called
initrd. This allows the required drivers to be determined and loaded. This, in turn, allows the user-space file system to load and prepare to establish the user-space environment.
The creation of the user-space environment is handled by the init process, which is the first process launched by the kernel in a user space. It has a process ID (PID) of 1. All other processes are either direct or indirect children of the init process.
systemd, the mainstream default for the init process was a reworking of the Unix System V init. There were other choices available, but System V init was the standard option in most non-Berkeley Software Distribution (BSD) derived distributions. Because it came directly from System V Unix—the spiritual ancestor of Linux—many people regard it as “the official way” to do init.
The init process starts all the daemons and services required to make the operating system work in a meaningful, interactive way. These daemons handle things like the networking stack, enabling other hardware inside your computer, and providing a boot screen.
Many of these background processes continue to run after they start. They do things like log event information, watch for hardware changes as you insert or remove devices, and manage user logins. Unsurprisingly, the init system also includes features to manage services.
We can use
ps to see the process that has PID 1. We’ll use the
f (full-format listing) and
p (PID) options:
ps -fp 1
We see the process with PID 1 is
systemd. Running the same command on Manjaro Linux yielded a different result. The process with PID 1 was identified as
/sbin/init. A quick look at that file shows it is a symbolic link to
ps -fp 1
ls -hl /sbin/init
ppid (parent process ID) option with
ps, we can see which processes have been directly launched by
ps -f --ppid 1
It’s quite a long list, as you can see in the image below.
Several projects have tried to produce an alternative to the traditional System V init. One of the main problems is, with System V init, all processes are started serially, one after another. To improve the efficiency of the boot sequence, many alternative projects use parallelism to start processes concurrently and asynchronously.
Here’s some info on some of these:
- Upstart: Developed by Canonical, it was used in Ubuntu 9.10, Red Hat, Red Hat Enterprise Linux (RHEL) 6, CentOS 6, and Fedora 9.
- Runit: Runs on FreeBSD and other BSD derivatives, macOS, and Solaris, as well as Linux systems. It’s also the default init system on Void Linux.
- s6-linux-init: This replacement for System V init was designed to closely follow the Unix philosophy, which is often reduced to the sound bite “do one thing, and do it well.”
There are many others of differing functionality and design. However, none of them created the furor
The systemd Way
systemd was released in 2010 and was used in Fedora in 2011. Since then, it’s been adopted by many distributions. It was developed by Lennart Poettering and Kay Sievers, two software engineers at RedHat.
systemd is much more than an init replacement. Rather, it’s a suite of approximately 70 binaries that handle system initialization, daemons and services, logging and journaling, and many other functions that were already handled by dedicated modules in Linux. The bulk of these have nothing to do with system initialization.
Some of the daemons provided by
- systemd-udevd: Manages physical devices.
- systemd-logind: Manages user logins.
- systemd-resolved: Provides network name resolution to local applications.
- systemd-networkd: Manages and detects network devices, and manages network configurations.
- systemd-tmpfiles: Creates, deletes, and cleans up volatile and temporary files and directories.
- systemd-localed: Manages system locale settings.
- systemd-machined: Detects and monitors virtual machines and containers.
- systemd-nspawn: Can launch a command or other process in a lightweight namespace container, giving a functionality similar to chroot.
And that’s just the tip of the iceberg, which is also the crux of the matter.
systemd has long since outstripped what’s required of an init system, which, according to its opponents, is the very definition of scope creep.
“It’s Too Big. It Does Too Much.”
systemd point out the large, curious mix of functionality it encompasses. All of these features already existed in Linux, and, perhaps, some of them needed a refresh or a new approach. However, to bundle all of this functionality in what is supposed to be an init system is architecturally puzzling.
systemd has been called a single point of failure for too many critical functions, but this doesn’t seem to be justifiable. Admittedly, it throws the Unix philosophy of creating small tools that work together instead of big pieces of software that do everything out the window. While
systemd isn’t strictly monolithic (it’s comprised of many binaries rather than a single huge one), it does include a lot of disparate management tools and commands under one umbrella.
While it might not be monolithic, it is big. To get an idea of scale, we counted the lines of text in the kernel 5.6.15 codebase and the
systemd master branch of the GitHub repository.
This was a relatively crude metric. It counted lines of text, not just lines of code. So, this included comments, documentation, and everything else. However, it was a like-for-like comparison and gave us a simple yardstick:
( find ./ -name '*.*' -print0 | xargs -0 cat ) | wc -l
The kernel had nearly 28 million (27,784,340, to be exact) lines of text. By contrast,
systemd had 1,349,969, or nearly 1.4 million. With our happy-go-lucky metric,
systemd comes out at about 5 percent the size of the kernel, which is crazy!
As another comparison, the line count for a modern implementation of System V init for the Arch Linux distribution came out to 1,721 lines.
Poettering plainly has no regard for the Institute of Electrical and Electronics Engineers (IEEE) Computer Society, nor the Portable Operating System Interface (POSIX) standard. In fact, he encouraged developers to ignore POSIX:
“So, get yourself a copy of The Linux Programming Interface, ignore everything it says about POSIX compatibility and hack away your amazing Linux software. It’s quite relieving!”
There have been accusations that
systemd is a Red Hat project that only benefits Red Hat, yet it’s being force-fed to the wider Linux world. Yes, it was birthed within Red Hat and is governed and steered by it. However, of the 1,321 contributors, only a fraction work for Red Hat.
So, what are the benefits to Red Hat?
“Red Hat considered many available options and even used Canonical’s Upstart for Red Hat Enterprise Linux 6. Ultimately, we chose systemd because it is the best architecture that provides the extensibility, simplicity, scalability, and well-defined interfaces to address the problems we see today and foresee in the future.”
Whitehurst also said they saw benefits in embedded systems, too. Red Hat partners with “the largest embedded vendors in the world, particularly in the telecom and automotive industries where stability and reliability is the number one concern.”
These seem like technically sound reasons. You can understand the company’s need for reliability, and it’s not unreasonable for Red Hat to look out for its own interests, but should everyone else follow suit?
Drinking the systemd Kool-Aid?
Some opponents of
systemd say distributions and people are just blindly following Red Hat’s lead and adopting it.
However, just like the phrase, “drinking the Kool-Aid,” that’s not quite right. Coined in 1978 after cult leader, Jim Jones, coerced his over 900 followers to commit suicide by drinking a grape-flavored liquid laced with cyanide, the phrase incorrectly shames Kool-Aid. The group actually drank Flavor Aid, but Kool-Aid’s been tarred by that brush ever since.
Plus, Linux distributions aren’t blindly following Red Hat; they’re adopting
systemd after serious deliberation. The debate raged on the Debian mailing lists for a long time. However, in 2014, the community voted to adopt
systemd as the default init system, but to also support alternatives.
Debian is an important example because it’s not derived from RedHat, Fedora, or CentOS. There’s no steerage applied to Debian from Red Hat. And Debian, like PID 1, has many descendants, including Ubuntu and its many spin-offs.
Decisions made by the Debian community are far-reaching. They’re also vigorously debated, and voted on using the Condorcet voting method. The community doesn’t make such choices lightly, either.
It voted again in December 2019 to continue to focus on
systemd and to continue to explore alternatives. The opposite of blindly following, this is actually a textbook example of democracy and freedom of choice at work.
The Limitations of Choice
You don’t generally get to choose whether to use
systemd with a particular Linux distribution. Rather, the distributions themselves choose whether they want to use it, and you can choose which Linux distro you prefer. Perhaps a Linux distribution you love switched to
systemd. Like a favorite musician who changes genres, this can be jarring.
People who use Debian, Fedora, CentOS, Ubuntu, Arch, Solus, and openSUSE, and object to the adoption of
systemd, might feel they’re being edged out of using their distribution of choice. If they feel strongly enough about any of the architectural choices, scope creep, or disregard for POSIX, they might find it untenable to keep using that distribution.
There’s a spectrum, of course. At one end, you have the people who don’t understand the issues (or even care), and at the other, you have the passionate objectors. Somewhere in the middle are those who don’t like changes, but aren’t bothered enough about it to jump ship. But what about the distribution refugees, who can’t stay on their chosen distribution due to their preferences or principles?
Unfortunately, it’s not as easy as just installing whichever init system you want. Not everyone has the technical ability to do that, nevermind the difficulties that arise when applications or desktop environments, such as GNOME, have dependencies on
What about moving to another distribution? Some, like Devuan, appeared as non-
systemd forks of distributions (in this case, Debian) that had adopted
systemd. Using Devuan should be similar to the parent distribution, but that’s not the case for all non-
systemd forks. For example, if you leave Fedora and move to AntiX, Gentoo, or Slackware, you’re going to have a very different experience.
It’s Not Going Anywhere
I like some of what
systemd does (simple and standardized control mechanisms for processes). I don’t understand the rationale for some of what it does (binary logs). I also dislike some of what it does (revamping home folders—who asked for that?).
Distributions like Debian are doing the smart thing and investigating alternatives to keep its options open. However,
systemd is in it for the long haul.
If you administer Linux machines for others, learn
systemd as well as you know System V init. This way, no matter which you encounter, you’ll be able to perform your duties.
Just use Linux at home? If so, choose a distribution that both meets your technical needs and complements your Linux ideology.