linux – initramfs systemd服务的内省 – 如何?

前端之家收集整理的这篇文章主要介绍了linux – initramfs systemd服务的内省 – 如何?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
背景

>我正在运行ArchLinux,使用systemd二进制文件作为initramfs的一部分启动必要的服务(root fs解密,安装等).
>我想检查一下作为这个阶段的一部分启动哪些systemd单元,以及何时启动.
> systemd-analyze plot只显示切换根发生后所有单元的时间图.
>交换机根单元(根据定义,initrd引导序列中的最后一个单元)指出:

[Service]
# ...
ExecStart=/usr/bin/systemctl --no-block --force switch-root /sysroot
# ...

> switch-root system命令上的systemctl手册页有这样的说法:

switch-root ROOT [INIT]

Switches to a different root directory and executes a new system manager process below it. This is intended for usage in initial RAM disks (“initrd”),and will transition from the initrd’s system manager process (a.k.a. “init” process) to the main system manager process which is loaded from the actual host volume. This call takes twoarguments: the directory that is to become the new root directory,and the path to the new system manager binary below it to execute as PID 1. If the latter is omitted or the empty string,a systemd binary will automatically be searched for and used as init. If the system manager path is omitted,equal to the empty string or identical to the path to the systemd binary,the state of the initrd’s system manager process is passed to the main system manager,which allows later introspection of the state of the services involved in the initrd boot phase.

然后在initrds问题上保持沉默……

启动后,我如何能够内省上面推断的initrd启动阶段所涉及的服务状态,或者发现甚至运行了哪些单元(因为有些是动态生成的)?

解决方法

https://freedesktop.org/wiki/Software/systemd/Debugging/建议使用journalctl -b查看引导时的日志消息.

猜你在找的Linux相关文章