Determining the init system in linux


برای این که بفهمیم init از چه معماری یا سیستمی استفاده می کند کافیست فایل زیر را ls و یا stat کنیم :

root@localhost:~# stat /sbin/init
File: /sbin/init -> /lib/systemd/systemd
Size: 20 Blocks: 0 IO Block: 4096 symbolic link
Device: fe01h/65025d Inode: 4461913 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-06-06 06:09:02.181563713 +0430
Modify: 2019-02-17 11:52:58.000000000 +0330
Change: 2019-04-06 05:21:24.757205553 +0430
Birth: -

همان طور که می بینید فایل /sbin/init یک فایل symbolic link به فایل اجرایی systemd است پس می توان نتیجه گرفت این سیستم از systemd استفاده می کند.
همچنین می توان فایل زیر را خواند و فهمید که سیستم با چه نوع معماری ای بوت شده است :

root@localhost:~# cat /proc/1/comm
systemd

In general, you can determine which init system is installed by checking whether the /sbin/init file is a symlink. If it’s not a symlink, then sysvinit is probably in use. If it’s a symlink pointing to /lib/systemd/systemd then systemd is in use. If it’s a symlink pointing to /lib/sysvinit/init then sysvinit is in use.

If you suspect that the init system may have been changed without a reboot, you may also cat /proc/1/comm to see which command name was used for the init daemon during the most recent boot. source


تست شده بر روی Debian 9

Initialization process concept in Linux

Does debian use systemd ?