mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
Merge pull request #27889 from lkxed/20221109-5-How-to-Find-Systemd-or-Any-Other-init-System-in-Linux
[手动选题][tech]: 20221109.5 ⭐️ How to Find Systemd or Any Other init System in Linux.md
This commit is contained in:
commit
d36e08e03f
@ -0,0 +1,81 @@
|
||||
[#]: subject: "How to Find Systemd or Any Other init System in Linux"
|
||||
[#]: via: "https://www.debugpoint.com/systemd-or-init/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Find Systemd or Any Other init System in Linux
|
||||
======
|
||||
|
||||
**Here’s how you can determine if you are running systems or any other init system in your Linux distribution.**
|
||||
|
||||
The first process, which starts when you boot up your Linux distribution, is called init (short for initialization). It has the process identifier 1 (i.e. pid=1). All the processes and applications in your Unix-based system are direct descendants of this init process.
|
||||
|
||||
Based on functionality and features, different types of init processes are present. For example, [systemd][1], Runit, OpenRC, sysVinit, etc. Among those, the systemd is the most popular and modern one, which is used and adopted by all the modern Linux distributions, including Ubuntu and Fedora.
|
||||
|
||||
There are ongoing debates about Systemd and its performance compared to the traditional Unix-based init systems. But that’s a topic for another article.
|
||||
|
||||
let’s find out how you can determine whether you are running a systemd or any other init system in your Linux distribution.
|
||||
|
||||
### Systemd or what init system?
|
||||
|
||||
Unfortunately, there’s no direct command to find it out. You can trace it back from the init process id=1, which is basically a symbolic link to `/sbin/init` i.e. pid=1.
|
||||
|
||||
Use `[strings][2]` command to print the text embedded in the binary file `/sbin/init` & search for init with the following command.
|
||||
|
||||
```
|
||||
strings /sbin/init | grep init
|
||||
```
|
||||
|
||||
**Example 1**: In this below output where it’s a sysVinit system running Debian (via Peppermint OS). As you can see, it clearly shows the init process name.
|
||||
|
||||
```
|
||||
strings /sbin/init | grep init
|
||||
```
|
||||
|
||||
![example showing the init is used and not systemd][3]
|
||||
|
||||
If you find systemd in the same above system, there won’t be any entries. Hence you can conclude that you are running sysvinit and not systemd.
|
||||
|
||||
**Example 2**: If you run the above command in a systemd system, you can easily see the systemd and its version at the first line of the output.
|
||||
|
||||
```
|
||||
strings /sbin/init | grep systemd
|
||||
```
|
||||
|
||||
![example showing it uses systemd][4]
|
||||
|
||||
**Example 3**: You can also try to print the process tree using `pstree` command, which should show you the first process name. It should be either systemd or init, as shown in the below example.
|
||||
|
||||
```
|
||||
pstree
|
||||
```
|
||||
|
||||
![pstree is showing systemd is used][5]
|
||||
|
||||
![pstree is showing init is used][6]
|
||||
|
||||
That’s it. This is how you can easily find out whether your distro uses systemd or something else.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/systemd-or-init/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/tag/systemd
|
||||
[2]: https://linux.die.net/man/1/strings
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/11/example-showing-the-init-is-used-and-not-systemd.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/11/example-showing-it-uses-systemd.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/11/pstree-is-showing-systemd-is-used.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/11/pstree-is-showing-init-is-used.jpg
|
Loading…
Reference in New Issue
Block a user