
如果我無法取得日誌,如何找出在關閉期間哪個服務使 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 被停止是否會阻止進一步的數據被報告?如果是這樣,有辦法解決這個問題嗎?