dmesg(display message或者driver message)是Linux系統中的一個命令,用于顯示內核啟動信息以及運行時的內核消息。這些消息通常包括硬件檢測、驅動加載、系統事件等信息。dmesg的輸出中包含了許多關鍵參數,以下是一些常見的參數及其含義:
以下是一個dmesg輸出示例:
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 5.4.0-42-generic (buildd@lgw01-amd64-039) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-42-generic root=UUID=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx ro quiet splash vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'compacted' format.
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bffaffff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000bffboooo] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000bfff0000-0x00000000bfffffff] ACPI data
[ 0.000000] BIOS-e820: [mem 0x00000000c0000000-0x00000000dfffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000ffffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000041fffffff] usable
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] SMBIOS 2.8 present.
在這個示例中,我們可以看到以下關鍵參數:
[ 0.000000],表示消息產生的時間。Linux version 5.4.0-42-generic,表示產生消息的內核版本。Initializing cgroup subsys cpuset,表示具體的消息描述。通過分析dmesg輸出中的這些關鍵參數,可以幫助我們診斷和解決Linux系統中的問題。