如果我无法获取日志,如何找出在关闭期间哪个服务使 systemd 停止运行?
几天来我一直在努力找出导致 systemd 每当我尝试重新启动或关闭时挂起的原因。它完成了关闭过程的一部分,但从未完成。该系统位于仅具有串行控制台用于访问的机器上。没有以太网端口。唯一可写的磁盘是 RAM 驱动器,因此重新启动后查看 journalctl 是没有用的。
该架构是 Arm64 上的 ubuntu 18.04,我所知道的如下:
[ OK Stopping Session 3 of user root.
[ OK ] Stopped target Timers.
[ OK ] Stopped Daily apt upgrade and clean activities.
[ OK ] Stopped Daily apt download activities.
[ OK ] Stopped Daily Cleanup of Temporary Directories.
Stopping Authorization Manager...
[ OK ] Stopped Discard unused blocks once a week.
Stopping Availability of block devices...
[ OK ] Stopped target Graphical Interface.
Stopping Disk Manager...
[ OK ] Stopped target Multi-User System.
Stopping strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf...
Stopping System Logging Service...
[ OK ] Stopped target Login Prompts.
Stopping Getty on tty1...
Stopping Serial Getty on ttyS0...
Stopping Unattended Upgrades Shutdown...
Stopping Dispatcher daemon for systemd-networkd...
Stopping D-Bus System Message Bus...
Stopping Chassis Fan Service...
Stopping Regular background program processing daemon...
Stopping OpenBSD Secure Shell server...
[ OK ] Stopped Resets System Activity Data Collector.
Stopping vsftpd FTP server...
Stopping Nexcopy Graphical Interface...
[ OK ] Stopped Nexcopy Gadget Service.
Stopping LSB: Load kernel image with kexec...
Stopping LSB: HPA's tftp server...
Stopping User Manager for UID 0...
[ OK ] Stopped target Host and Network Name Lookups.
Stopping Getty on ttyGS0...
[ OK ] Stopped Message of the Day.
Stopping Network Name Resolution...
[ OK ] Stopped Network Name Resolution.
[ OK ] Stopped System Logging Service.
[ OK ] Stopped Dispatcher daemon for systemd-networkd.
[ OK ] Stopped Disk Manager.
[ OK ] Stopped strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
[ OK ] Stopped Regular background program processing daemon.
[ OK ] Stopped vsftpd FTP server.
[ OK ] Stopped Unattended Upgrades Shutdown.
[ OK ] Stopped Serial Getty on ttyS0.
[ OK ] Stopped Nexcopy Graphical Interface.
[ OK ] Stopped Getty on tty1.
无论导致挂起的原因是什么,都可能是正在尝试的下一个服务。我怎样才能确定那是什么?
restart -f 工作正常,所以我知道这不是硬件问题。
有没有办法让 systemd 输出有关它试图停止的服务的更详细信息?
我试过:
systemctl 重启 --dry-run
希望它能告诉我它想做什么,但显然 --dry-run 被忽略了,因为无论如何它启动了一个真正的关闭程序。
有什么方法可以让 systemd 输出它的任务列表,以便我可以看到队列中的下一个任务是什么?仅通过一个串行控制台进行访问,我不确定我还能尝试什么。
有人有建议吗?
编辑:看完这篇文章后我有一个问题。本系统中的ttyS0是控制台,也是我登录的端口。我注意到在消息退出之前不久,getty 在此端口上停止,因此大概我已注销。 getty 被停止是否会阻止进一步的数据被报告?如果是这样,有办法解决这个问题吗?