This article shows three methods for verifying whether your Linux system uses a systemd or another init system.
Init and SystemD #
systemd acts as the init system that brings and maintains userspace services when run as the first process on boot (PID 1). PID 1 is the init, and it is the first Linux user-mode process. It runs until the system shuts down. Kernel directly starts systemd which own PID 1. If the system fails to load it, you will experience a “Kernel Panic” state.
Since the release of System V init (the first commercial system designed to run on init), the SysV init system has been the most popular until the arrival of SystemD. After the release of SystemD, some setbacks exist in init; the most highlighted thing here is the lack of parallel processing on system boot.
Type 1: PS Command Output #
The following command will provide the command section from the ps command output for the first process.
If the system runs on systemd, we will get it in the result; however, different systems might output some random text.
Type 2: Symbolic Link in the PS Output #
As you already know, init is the first process with “PID = 1“, so check the first process output using the ps command.
We can also use the file command to output the actual process.
Alternatively, we can use the stat command to find the actual process with more information.
#
Type 3: Use of Pstree Command #
This method varies depending on our system; if they have the pstree utility, verify the process tree to see if our system is running on systemd.
Therefore, the abovementioned steps are the easiest way to verify whether our system is running on systemd.