--test 选项不适用于 /sbin/init

--test 选项不适用于 /sbin/init

根据man init(1)它,--test应该有一个选项。事实上,当我尝试测试它时,我遇到了错误

root@mst-sls:~# /sbin/init --test
/sbin/init: unrecognized option '--test'

不被认可是什么?

答案1

也来自man init:

For compatibility with SysV, if systemd is called as init and a PID
that is not 1, it will execute telinit and pass all command line
arguments unmodified. That means init and telinit are mostly equivalent
when invoked from normal login sessions. See telinit(8) for more
information.

因此,您运行的方式init,所有参数都传递给telinit,并且telinit没有--test选项。

您可以systemd直接调用:

systemd --test

相关内容