Why SystemD over Sysvinit ?

Arun Prakash
3 min readJan 28, 2024

--

When it comes to choosing an init system for your Linux distribution, the debate often revolves around Sysvinit and SystemD. Both of these init systems have their own design principles and approaches to managing system services. In this article, we’ll delve into the strengths and weaknesses of Sysvinit and SystemD, ultimately helping you make an informed decision.

Sysvinit: Legacy and Sequential Approach

Sysvinit relies on shell scripts located in the /etc/init.d/ directory to start, stop, and manage services. Its architecture has a significant advantage in terms of legacy system compatibility, stability, and the ability to manually customize initialization scripts. However, Sysvinit follows a sequential approach during the boot process, which can lead to slower boot times.

The sequential nature of Sysvinit means that services start one after the other, making less efficient use of modern multi-core processors. On the other hand, SystemD introduces parallelization, allowing services to start concurrently, maximizing the utilization of multi-core processors and resulting in faster boot times.

Therefore, if legacy compatibility is paramount, sticking with Sysvinit may be the preferred choice. However, for those seeking improved performance and taking advantage of modern hardware capabilities, SystemD is a more suitable option.

Exploring Alternatives

If you’re open to exploring alternative init systems, options like Upstart, OpenRC, runit, s6, and OpenBSD init are worth considering. Each has its own set of features and advantages, so it’s essential to evaluate them based on your specific requirements.

SystemD: The Modern Approach

Modern Linux distributions, including Debian 9+, Fedora 15+, CentOS 7+, and others, have adopted SystemD as their default init system. SystemD is not just an init system; it is a collection of programs and libraries, including systemd, systemd-journald, systemd-init, systemd-networkd, systemd-logind, and more.

Core Responsibilities of SystemD

  • Init Process: SystemD serves as the first process started by the kernel during boot-up, managing the entire boot process.
  • Orphan Process Handling: When a process becomes orphaned, SystemD automatically reparents it under the init process.
  • Zombie Process Cleanup: SystemD takes care of killing zombie processes, preventing resource leaks.
  • System State and Services: It is responsible for handling system state and services while the system is up and running.

System Units: A Fundamental Concept

In SystemD, any entity managed by the init system is referred to as a unit. SystemD manages various types of units, including services, sockets, devices, mount points, swap files, partitions, startup targets, and watched filesystem paths. The unit files are stored in two main locations: lib/systemd/system for standard systemd unit files and etc/systemd/system for custom unit files.

Managing SystemD

To force SystemD to read unit files after making changes, the command systemctl daemon-reload is used. It's important to note that using systemctl restart is necessary after reloading the daemon, as the reload itself will not apply the changes to the refactored unit files.

For inspecting SystemD unit files, the command systemctl status <unit file name> provides information on whether the unit is loaded, active, and more.

Conclusion

In the Sysvinit vs SystemD debate, the choice ultimately depends on your specific needs. Sysvinit may be the right fit for legacy systems, while SystemD offers improved performance and takes advantage of modern hardware capabilities. Exploring alternative init systems can also provide unique features based on your requirements. As Linux continues to evolve, understanding the strengths and weaknesses of different init systems is essential for making informed decisions in system administration.

--

--

Arun Prakash
Arun Prakash

Written by Arun Prakash

I write about Cloud, DevOps and SRE Stuffs! Passionate about Security !