介紹 Systemd 新指令
journalctl -b - show the log since the last boot
1. 顯示出
這一次 開機記錄
這在 Debug 上提供了很方便的幫助
2. 舉例
Ubuntu 15.04 64 bit 安裝於 Virtualbox 4.3.26
sudo journalctl -b --no-pager # 不加 --no-pager 會一次顯示一頁
-- Logs begin at 二 2015-04-28 09:22:21 CST, end at 二 2015-04-28 09:35:42 CST. --
4月 28 09:22:21 Server06 systemd-journal[193]: Runtime journal is using 4.0M (max allowed 14.9M, trying to leave 22.4M free of 145.4M available → current limit 14.9M).
4月 28 09:22:21 Server06 systemd-journal[193]: Runtime journal is using 4.0M (max allowed 14.9M, trying to leave 22.4M free of 145.4M available → current limit 14.9M).
4月 28 09:22:21 Server06 kernel: Initializing cgroup subsys cpuset
4月 28 09:22:21 Server06 kernel: Initializing cgroup subsys cpu
4月 28 09:22:21 Server06 kernel: Initializing cgroup subsys cpuacct
4月 28 09:22:21 Server06 kernel: Linux version 3.19.0-15-generic (buildd@komainu) (gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13) ) #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 (Ubuntu 3.19.0-15.15-generic 3.19.3)
4月 28 09:22:21 Server06 kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-3.19.0-15-generic root=UUID=76f6686b-0a45-4696-9a0e-09cf3793a5b5 ro locale=zh_CN quiet splash
4月 28 09:22:21 Server06 kernel: KERNEL supported cpus:
4月 28 09:22:21 Server06 kernel: Intel GenuineIntel
4月 28 09:22:21 Server06 kernel: AMD AuthenticAMD
4月 28 09:22:21 Server06 kernel: Centaur CentaurHauls
4月 28 09:22:21 Server06 kernel: e820: BIOS-provided physical RAM map:
4月 28 09:22:21 Server06 kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
... / 中間省略 / ...
4月 28 09:22:35 Server06 lightdm[885]:
PAM unable to dlopen(pam_kwallet.so): /lib/security/pam_kwallet.so: cannot open shared object file: No such file or directory
4月 28 09:22:35 Server06 lightdm[885]:
PAM adding faulty module: pam_kwallet.so
.. / 中間省略 / ...
4月 28 09:35:42 Server06 sudo[2186]: username : TTY=pts/2 ; PWD=/home/username ; USER=root ; COMMAND=/bin/journalctl -b --no-pager
4月 28 09:35:42 Server06 sudo[2186]: pam_unix(sudo:session): session opened for user root by username(uid=0)
2-1. 值得注意的是
開始記錄的時程 比 /var/log/syslog 早許多
而且更詳細
有錯誤的地方自動使用紅色顯示出來
...
這在 Grub 2 等等 開機/初始化 Debug 有很大的幫助
3. journalctl 其它參數 參見
http://manpages.ubuntu.com/manpages/uto ... ctl.1.html
還沒有 15.04