透過 systemd 日誌找出系統異常的根本原因 — 重開、當機、過熱、OOM、Kernel Panic。
journalctl -n 50 # 最後 50 行
journalctl -f # 即時追蹤
journalctl --since "1 hour ago" # 最近一小時
journalctl -u ssh.service # 只看某個 service
last reboot # 重開機歷史
journalctl --list-boots # Boot ID 列表
journalctl -b 0 # 本次開機
journalctl -b -1 # 前一次
journalctl -b -2 # 前兩次
journalctl -b -2 -e # 前一次結尾(檢查關機)
正常關機結尾會看到:
System is going down for poweroff
Reached target Power-Off
journalctl -b -1 | grep -i "temperature\|thermal" # 過熱檢查
journalctl -b -1 | grep -i "oom\|out of memory" # OOM 檢查
journalctl -b -1 | grep -i "panic" # Kernel Panic 檢查
sudo journalctl --vacuum-time=30d # 保留 30 天
sudo journalctl --vacuum-size=500M # 限制大小 500MB
7/18 跳電: 桌機 I610M4 從 7/18 ~ 7/19 下午斷線約一天。
last reboot 確認最後開機為 7/19 22:56 → journalctl -b -2 -e 確認前次無正常關機訊息 → 無過熱/OOM/Panic 紀錄 → 結論:外部跳電。
這篇筆記同步收錄在 Obsidian 知識庫中。相關主題:dmesg、systemd、OOM Killer、Kernel Panic。