dmesg
(display message或者driver message)是Linux系统中的一个命令,用于显示内核启动信息和运行时的硬件设备状态信息。当你在Linux系统中遇到问题时,dmesg
命令可以帮助你找到问题的根源。以下是一些常见的dmesg
日志异常原因及其分析方法:
free -m
命令查看内存使用情况,使用vmstat
监控内存状态。fsck
命令检查和修复文件系统错误。ping
、traceroute
等工具诊断网络问题。/etc/sysctl.conf
文件,确保内核参数配置正确。apt
、yum
等包管理工具检查和解决软件冲突。dmesg
命令查看最新的日志信息。dmesg | less
grep
命令过滤出关键错误信息。dmesg | grep -i error
lshw
、lsusb
、lspci
等工具查看硬件状态。假设你在dmesg
日志中看到以下信息:
[ 0.000000] Linux version 5.4.0-42-generic (buildd@lgw01-amd64-039) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46~18.04.1-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=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 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 0x00000000bfc00000-0x00000000bfffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000c0000000-0x00000000cfffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0000000-0x00000000d0010fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0011000-0x00000000d0011fff] ACPI data
[ 0.000000] BIOS-e820: [mem 0x00000000d0012000-0x00000000d0012fff] ACPI NVS
[ 0.000000] BIOS-e820: [mem 0x00000000d0013000-0x00000000d0013fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0014000-0x00000000d0014fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0015000-0x00000000d0015fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0016000-0x00000000d0016fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0017000-0x00000000d0017fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0018000-0x00000000d0018fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0019000-0x00000000d0019fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d001a000-0x00000000d001afff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d001b000-0x00000000d001bfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d001c000-0x00000000d001cfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d001d000-0x00000000d001dfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d001e000-0x00000000d001efff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d001f000-0x00000000d001ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0020000-0x00000000d0020fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0021000-0x00000000d0021fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0022000-0x00000000d0022fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0023000-0x00000000d0023fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0024000-0x00000000d0024fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0025000-0x00000000d0025fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0026000-0x00000000d0026fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0027000-0x00000000d0027fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0028000-0x00000000d0028fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0029000-0x00000000d0029fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d002a000-0x00000000d002afff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d002b000-0x00000000d002bfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d002c000-0x00000000d002cfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d002d000-0x00000000d002dfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d002e000-0x00000000d002efff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d002f000-0x00000000d002ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0030000-0x00000000d0030fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0031000-0x00000000d0031fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0032000-0x00000000d0032fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0033000-0x00000000d0033fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0034000-0x00000000d0034fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0035000-0x00000000d0035fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0036000-0x00000000d0036fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0037000-0x00000000d0037fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0038000-0x00000000d0038fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d0039000-0x00000000d0039fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d003a000-0x00000000d003afff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d003b000-0x00000000d003bfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d003c000-0x00000000d003cfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d003d000-0x00000000d003dfff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d003e000-0x00000000d003efff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000d003f000-0x00000000d003ffff] reserved
[ 0.00000