解释 dmesg 和 /var/log/boot.log 的输出

use*_*508 3 boot logs dmesg

我找到了两种打印引导消息的方法,一种使用 dmesg,另一种使用文件 /var/log/boot.log 的内容:

/var/log/boot.log 文件的内容是:

 fsck from util-linux 2.20.1
/dev/loop0: clean, 263563/2271232 files, 7843644/18169856 blocks
 * Starting configure network device security^[[74G[ OK ]
 * Starting configure network device security^[[74G[ OK ]
 * Starting configure network device^[[74G[ OK ]
 * Starting Mount network filesystems^[[74G[ OK ]
 * Starting Failsafe Boot Delay^[[74G[ OK ]
 * Stopping Mount network filesystems^[[74G[ OK ]
 * Starting Bridge socket events into upstart^[[74G[ OK ]
 * Starting mDNS/DNS-SD daemon^[[74G[ OK ]
 * Starting Userspace bootsplash^[[74G[ OK ]
 * Starting Send an event to indicate plymouth is up^[[74G[ OK ]
 * Starting bluetooth daemon^[[74G[ OK ]
 * Starting configure network device^[[74G[ OK ]
 * Stopping Failsafe Boot Delay^[[74G[ OK ]
 * Starting System V initialisation compatibility^[[74G[ OK ]
 * Starting set sysctls from /etc/sysctl.conf^[[74G[ OK ]
 * Starting configure network device security^[[74G[ OK ]
 * Starting modem connection manager^[[74G[ OK ]
 * Stopping set sysctls from /etc/sysctl.conf^[[74G[ OK ]
 * Starting CUPS printing spooler/server^[[74G[ OK ]
 * Starting network connection manager^[[74G[ OK ]
 * Stopping cold plug devices^[[74G[ OK ]
 * Stopping log initial device creation^[[74G[ OK ]
 * Starting configure network device security^[[74G[ OK ]
 * Starting save udev log and update rules^[[74G[ OK ]
 * Stopping save udev log and update rules^[[74G[ OK ]
 * Stopping Userspace bootsplash^[[74G[ OK ]
Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
 * Starting AppArmor profiles       ^[[170G
^[[164G[ OK ]
speech-dispatcher disabled; edit /etc/default/speech-dispatcher
saned disabled; edit /etc/default/saned
 * Stopping System V initialisation compatibility^[[74G[ OK ]
 * Starting System V runlevel compatibility^[[74G[ OK ]
Run Code Online (Sandbox Code Playgroud)

而 dmesg 给出了这样的东西:

[    0.008660] Initializing cgroup subsys blkio
[    0.008663] Initializing cgroup subsys perf_event
[    0.008667] Initializing cgroup subsys hugetlb
[    0.008713] CPU: Physical Processor ID: 0
[    0.008716] CPU: Processor Core ID: 0
[    0.008720] mce: CPU supports 4 MCE banks
[    0.008739] CPU0: Thermal monitoring enabled (TM1)
[    0.008746] process: using mwait in idle threads
[    0.008753] Last level iTLB entries: 4KB 64, 2MB 64, 4MB 64
[    0.008753] Last level dTLB entries: 4KB 64, 2MB 0, 4MB 64
[    0.008753] tlb_flushall_shift: 6
[    0.008895] Freeing SMP alternatives: 24k freed
[    0.011699] ACPI: Core revision 20121018
[    0.016015] ftrace: allocating 29358 entries in 115 pages
[    0.028544] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.068468] smpboot: CPU0: Intel(R) Pentium(R) 4 CPU 3.00GHz (fam: 0f, model: 04, stepping: 09)
[    0.072000] Performance Events: Netburst events, Netburst P4/Xeon PMU driver.
[    0.072000] ... version:                0
Run Code Online (Sandbox Code Playgroud)

等等

所以我的问题是这两者有什么关系?我们什么时候应该使用 demsg,什么时候使用 boot.log?

UVV*_*UVV 6

dmesg 输出是 Linux 内核的诊断信息,即一些有关硬件和驱动程序初始化的信息。

boot.log似乎是您的发行版的一个特定功能(我没有),它向您显示了位于/etc/rc.d/或 的守护进程和其他初始化脚本的成功/失败启动日志/etc/init.d/。这些 initscripts 在 Linux 内核启动后启动。