mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
commit
7a495205a3
@ -1,81 +0,0 @@
|
||||
[#]: 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: "geekpi"
|
||||
[#]: 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
|
@ -0,0 +1,82 @@
|
||||
[#]: 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: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 Linux 中查找 Systemd 或任何其他 init 系统
|
||||
======
|
||||
|
||||
**你可以通过以下方式确定你的 Linux 发行版中是否正在运行系统或任何其他 init 系统。**
|
||||
|
||||
第一个进程在你启动 Linux 发行版时开始,称为 init(初始化的缩写)。它的进程标识符为 1(即 pid=1)。基于 Unix 的系统中的所有进程和应用程序都是这个 init 进程的直接后代。
|
||||
|
||||
根据功能和特性,存在不同类型的初始化进程。例如,[systemd][1]、Runit、OpenRC、sysVinit 等。其中,systemd 是最流行和最现代的一种,被包括 Ubuntu 和 Fedora 在内的所有现代 Linux 发行版使用和采用。
|
||||
|
||||
与传统的基于 Unix 的 init 系统相比,Systemd 及其性能一直存在争议。但这是另一篇文章的主题。
|
||||
|
||||
让我们看看如何确定在 Linux 发行版中运行的是 systemd 还是任何其他 init 系统。
|
||||
|
||||
### systemd 还是什么 init 系统?
|
||||
|
||||
不幸的是,没有直接的命令可以找到它。你可以从初始化进程 id=1 追溯它,它基本上是到 `/sbin/init` 的符号链接,即 pid=1。
|
||||
|
||||
使用 `[strings][2]` 命令打印嵌入在二进制文件 `/sbin/init` 中的文本并使用以下命令搜索 init。
|
||||
|
||||
|
||||
```
|
||||
strings /sbin/init | grep init
|
||||
```
|
||||
|
||||
**示例 1**:在下面的输出中,它是一个运行 Debian(通过 Peppermint OS)的 sysVinit 系统。如你所见,它清楚地显示了 init 进程名称。
|
||||
|
||||
```
|
||||
strings /sbin/init | grep init
|
||||
```
|
||||
|
||||
![显示使用 init 而不是 systemd 的示例][3]
|
||||
|
||||
如果在上述同一个系统中找到 systemd,那么不会有任何条目。因此,你可以得出结论,你正在运行 sysvinit 而不是 systemd。
|
||||
|
||||
**示例 2**:如果你在 systemd 系统中运行上述命令,你可以在输出的第一行轻松看到 systemd 及其版本。
|
||||
|
||||
```
|
||||
strings /sbin/init | grep systemd
|
||||
```
|
||||
|
||||
![显示它使用 systemd 的示例][4]
|
||||
|
||||
**示例 3**:你也可以尝试使用 `pstree` 命令打印进程树,它应该会显示第一个进程名称。它应该是 systemd 或 init,如下例所示。
|
||||
|
||||
```
|
||||
pstree
|
||||
```
|
||||
|
||||
![pstree 显示使用 systemd][5]
|
||||
|
||||
![pstree 显示使用 init][6]
|
||||
|
||||
这就好了。这样你就可以轻松找出你的发行版是使用 systemd 还是其他的。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/systemd-or-init/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者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