Function Description:Displays the boot information.
Syntax:Dmesg [-cn] [-S <buffer size>]
Note:The kernel stores the boot information in the ring buffer. You can use dmesg to view the information if you cannot view it at startup. The boot information is also saved in the/var/log directory and named dmesg.
Parameters:
-C: After the information is displayed, clear the content in the ring buffer.
-S <buffer size> is set to 8196, which is equal to the ring buffer size.
-N: set the record information level.
Extended reading 1: Main usage of the dmesg command
Main applications:
Dmesg is used to display the kernel-ring buffer content. The kernel stores various messages here. During system boot, the kernel fills in information related to hardware and module initialization in this buffer zone. Messages in the kernel ring buffer are usually very useful for diagnosing system problems. When running dmesg, it displays a large amount of information. Generally, you can use the less or grep pipeline to view dmesg output, which makes it easier to find the information to be queried. For example, if the hard disk performance is poor, you can use dmesg to check whether they are running in DMA mode:
$ Dmesg | grep DMA
...
Ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda: DMA, HDB: DMA
Ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: HDC: DMA, HDD: DMA
...
The above lines show the mode in which each ide device is running. If there is a problem with the Ethernet connection, you can search for eth in the dmesg log:
$ Dmesg | grep ETH
Forcedeth. C: reverse engineered nforce
Ethernet driver. Version 0.49.
Eth0: forcedeth. C: subsystem: 0147b: 1c00
Bound to expiration :00:04. 0
Eth0: No IPv6 routers present
If everything works, dmesg displays the hardware configuration information for each Nic. If a system service fails to be correctly configured, The dmesg log will soon fill up the error message, which is a good starting point for fault diagnosis.
It can also be used to detect the loading of system kernel modules, for example, to detect ACPI loading, use dmesg | grep ACPI
Dmesg | egrep-I ''(APM | ACPI )''
Kernel command line: VGA = 274 quiet console = ttys3, 9600 ACPI = No-idleoot =/dev/hda3
ACPI: Core subsystem version [1, 20010208]
ACPI: subsystem enabled
ACPI: System firmware supports: C2
ACPI: plvl2lat = 99 plvl3lat = 1001.
ACPI: C2 enter= 1417 C2 exit = 354
ACPI: C3 enter =-1 C3 exit =-1
ACPI: Not using ACPI idle
ACPI: System firmware supports: S0 S1 S4 S5
Extended reading 2: dmesg command example
Example 1: Send the boot information to man dmesg and write the program helps users to print out their bootup messages. instead of copying the messages by hand, the user need only:
Dmesg> boot. Messages
And mail the boot. Messages file to whoever can debug their problem.
[[Email protected] ~] # Dmesg> boot. Messages
[[Email protected] ~] # Ls-l boot. Messages
-RW-r -- 1 Root 15838 12-09 12 begin_of_the_skype_highlighting 15838 12-09 12 free end_of_the_skype_highlighting: 55 boot. Messages
[[Email protected] ~] # Mail-s "Boot log of Linux Server" P [email protected] <boot. Messages
[[Email protected] ~] #
Example 2: View dmesg output information
[[Email protected] ~] # Uname-
Linux new55 2.6.18-194. EL5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[[Email protected] ~] # Dmesg | less
Linux version 2.6.18-194. EL5 ([email protected]) (GCC version 4.1.2 20080704 (Red Hat 4.1.2-48) #1 SMP Tue Mar 16 21:52:43 EDT 2010
BIOS-provided physical Ram map:
BIOS-e820: 0000000000010000-000000000009fc00 (usable)
BIOS-e820: 000000000009fc00-00000000000a0000 (Reserved)
BIOS-e820: 201710000000e0000-0000000000100000 (Reserved)
BIOS-e820: 0000000000100000-000000001f7d0000 (usable)
BIOS-e820: 2017100001f7d0000-2017100001f7efc00 (Reserved)
BIOS-e820: 2017100001f7efc00-2017100001f7fb000 (acpi nvs)
BIOS-e820: 2017100001f7fb000-2017100001f800000 (Reserved)
BIOS-e820: Too Many e0000000-too many f0000000 (Reserved)
BIOS-e820: 201710000fec00000-201710000fec02000 (Reserved)
BIOS-e820: 0000000020000-00000000fed9b000 (Reserved)
BIOS-e820: 00000000a0000-00000000fedc0000 (Reserved)
BIOS-e820: 00000000ffb00000-00000000ffc00000 (Reserved)
BIOS-e820: effec0000fff00000-0000000100000000 (Reserved)
0 MB highmem available.
503 MB lowmem available.
Memory for crash kernel (0x0 to 0x0) notwithin permissible range
Disabling kdump
Using x86 segment limits to approximate NX Protection
On node 0 totalpages: 128976
DMA zones: 4096 pages, LIFO batch: 0
Normal zone: 124880 pages, LIFO batch: 31
DMI 2.3 present.
Using APIC driver default
ACPI: rsdp (v000 HP) @ 0x000fe270
ACPI: rsdt (v001 HP 30c4 0x31100620 HP 0x00000001) @ 0x1f7efc84
ACPI: fadt (v002 HP 30c4 0x00000002 HP 0x00000001) @ 0x1f7efc00
ACPI: madt (v001 HP 30c4 0x00000001 HP 0x00000001) @ 0x1f7efcb8
ACPI: mcfg (v001 HP 30c4 0x00000001 HP 0x00000001) @ 0x1f7efd14
ACPI: ssdt (v001 HP hpqppc 0x00001001 MSFT 0x0100000e) @ 0x1f7f6698
ACPI: dsdt (v001 HP dau00 0x00010000 MSFT 0x0100000e) @ 0x00000000
ACPI: PM-timer IO port: 0x1008
ACPI: Local APIC address 0xfec01000
ACPI: lapic (acpi_id [0x01] lapic_id [0x00] enabled)
Processor #0 6:13 APIC version 20
ACPI: lapic_nmi (acpi_id [0x01] High edge lint [0x1])
ACPI: ioapic (ID [0x01] address [0xfec00000] gsi_base [0])
Ioapic [0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
:
Example 3: view the dmesg tail Information
[[Email protected] ~] # Dmesg | tail
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP Socket Layer initialized
Bluetooth: RFCOMM Socket Layer initialized
Bluetooth: RFCOMM tty layer initialized
Bluetooth: RFCOMM ver 1.8
Bluetooth: hidp (Human Interface emulation) Ver 1.1
Eth0: No IPv6 routers present
Installing knfsd (Copyright (c) 1996 [email protected]).
NFSD: Using/var/lib/nfs/v4recovery as the nfsv4 state recovery directory
NFSD: Starting 90-second grace period
[[Email protected] ~] #
Example 4 kernel log when the SS7 driver is installed
[[Email protected] ss7dpklnx] # cd ss7hd_driver/
[[Email protected] ss7hd_driver] # ls
Bbdddlnx_iss.h bbd_hbi.h bbd_ioc.c bbd_isr.c bbd_pci.c bsd_license.txt GPL_V2-only_license.txt install_ss7hd.sh makefile26
Bbd_def.h bbd_hs.c bbd_ioc.h bbd_lnx.c bbd_pro.h build_ss7hd.sh i21555.h makefile24
[[Email protected] ss7hd_driver] #./build_ss7hd.sh
Make: Entering directory '/usr/src/kernels/2.6.9-22. EL-i686'
CC [m]/root/Setup/ss7dpklnx/ss7hd_driver/bbd_hs.o
CC [m]/root/Setup/ss7dpklnx/ss7hd_driver/bbd_ioc.o
CC [m]/root/Setup/ss7dpklnx/ss7hd_driver/bbd_isr.o
CC [m]/root/Setup/ss7dpklnx/ss7hd_driver/bbd_pci.o
CC [m]/root/Setup/ss7dpklnx/ss7hd_driver/bbd_lnx.o
LD [m]/root/Setup/ss7dpklnx/ss7hd_driver/ss7hddvr26. o
Building modules, stage 2.
Modpost
CC/root/Setup/ss7dpklnx/ss7hd_driver/ss7hddvr26. Mod. o
LD [m]/root/Setup/ss7dpklnx/ss7hd_driver/ss7hddvr26. Ko
Make: Leaving directory/usr/src/kernels/2.6.9-22. EL-i686 'HTTP: // www.linuxso.com/command/dmesg.html
[[Email protected] ss7hd_driver] #./install_ss7hd.sh
[[Email protected] ss7hd_driver] # lsmod | grep SS7
Ss7hddvr26 25808 0
[[Email protected] ss7hd_driver] # dmesg | tail
ACPI: PCI interrupt 0000: 02: 0d. 0 [?] -> GSI 9 (level, low)-> IRQ 9
BBD [0] 64bit
Ss7hd [0]-Suspend
Dialogic ss7hd Device Driver v100.00 (source v1.21)
Copyright (c) dialogic Corporation 2003-2010. All Rights Reserved
Using major device number 251.
ACPI: PCI interrupt 0000: 02: 0d. 0 [?] -> GSI 9 (level, low)-> IRQ 9
BBD [0] 64bit
[[Email protected] ss7hd_driver] #./install_ss7hd.sh remove
[[Email protected] ss7hd_driver] # lsmod | grep SS7
[[Email protected] ss7hd_driver] # dmesg | tail
BBD [0] 64bit
Ss7hd [0]-Suspend
Dialogic ss7hd Device Driver v100.00 (source v1.21)
Copyright (c) dialogic Corporation 2003-2010. All Rights Reserved
Using major device number 251.
ACPI: PCI interrupt 0000: 02: 0d. 0 [?] -> GSI 9 (level, low)-> IRQ 9
BBD [0] 64bit
Ss7hd [0]-Suspend
[[Email protected] ss7hd_driver] #
Example 5 print and clear the kernel ring Buffer
[[Email protected] ~] # Dmesg-C
Linux version 2.6.18-194. EL5 ([email protected]) (GCC version 4.1.2 20080704 (Red Hat 4.1.2-48) #1 SMP Tue Mar 16 21:52:43 EDT 2010
BIOS-provided physical Ram map:
BIOS-e820: 0000000000010000-000000000009fc00 (usable)
BIOS-e820: 000000000009fc00-00000000000a0000 (Reserved)
BIOS-e820: 201710000000e0000-0000000000100000 (Reserved)
BIOS-e820: 0000000000100000-000000001f7d0000 (usable)
BIOS-e820: 2017100001f7d0000-2017100001f7efc00 (Reserved)
BIOS-e820: 2017100001f7efc00-2017100001f7fb000 (acpi nvs)
BIOS-e820: 2017100001f7fb000-2017100001f800000 (Reserved)
BIOS-e820: Too Many e0000000-too many f0000000 (Reserved)
BIOS-e820: 201710000fec00000-201710000fec02000 (Reserved)
BIOS-e820: 0000000020000-00000000fed9b000 (Reserved)
BIOS-e820: 00000000a0000-00000000fedc0000 (Reserved)
BIOS-e820: 00000000ffb00000-00000000ffc00000 (Reserved)
BIOS-e820: effec0000fff00000-0000000100000000 (Reserved)
0 MB highmem available.
503 MB lowmem available.
Memory for crash kernel (0x0 to 0x0) notwithin permissible range
Disabling kdump
Using x86 segment limits to approximate NX Protection
On node 0 totalpages: 128976
DMA zones: 4096 pages, LIFO batch: 0
Normal zone: 124880 pages, LIFO batch: 31
DMI 2.3 present.
Omitted output
Bluetooth: hidp (Human Interface emulation) Ver 1.1
Eth0: No IPv6 routers present
Installing knfsd (Copyright (c) 1996 [email protected]).
NFSD: Using/var/lib/nfs/v4recovery as the nfsv4 state recovery directory
NFSD: Starting 90-second grace period
[[Email protected] ~] # Dmesg
[[Email protected] ~] # Less/var/log/dmesg
Linux version 2.6.18-194. EL5 ([email protected]) (GCC version 4.1.2 20080704 (Red Hat 4.1.2-48) #1 SMP Tue Mar 16 21:52:43 EDT 2010
BIOS-provided physical Ram map:
BIOS-e820: 0000000000010000-000000000009fc00 (usable)
BIOS-e820: 000000000009fc00-00000000000a0000 (Reserved)
BIOS-e820: 201710000000e0000-0000000000100000 (Reserved)
BIOS-e820: 0000000000100000-000000001f7d0000 (usable)
BIOS-e820: 2017100001f7d0000-2017100001f7efc00 (Reserved)
BIOS-e820: 2017100001f7efc00-2017100001f7fb000 (acpi nvs)
BIOS-e820: 2017100001f7fb000-2017100001f800000 (Reserved)
BIOS-e820: Too Many e0000000-too many f0000000 (Reserved)
BIOS-e820: 201710000fec00000-201710000fec02000 (Reserved)
BIOS-e820: 0000000020000-00000000fed9b000 (Reserved)
BIOS-e820: 00000000a0000-00000000fedc0000 (Reserved)
BIOS-e820: 00000000ffb00000-00000000ffc00000 (Reserved)
BIOS-e820: effec0000fff00000-0000000100000000 (Reserved)
0 MB highmem available.
503 MB lowmem available.
Memory for crash kernel (0x0 to 0x0) notwithin permissible range
Disabling kdump
Using x86 segment limits to approximate NX Protection
On node 0 totalpages: 128976
DMA zones: 4096 pages, LIFO batch: 0
Normal zone: 124880 pages, LIFO batch: 31
DMI 2.3 present.
Using APIC driver default
ACPI: rsdp (v000 HP) @ 0x000fe270
ACPI: rsdt (v001 HP 30c4 0x31100620 HP 0x00000001) @ 0x1f7efc84
ACPI: fadt (v002 HP 30c4 0x00000002 HP 0x00000001) @ 0x1f7efc00
ACPI: madt (v001 HP 30c4 0x00000001 HP 0x00000001) @ 0x1f7efcb8
ACPI: mcfg (v001 HP 30c4 0x00000001 HP 0x00000001) @ 0x1f7efd14
ACPI: ssdt (v001 HP hpqppc 0x00001001 MSFT 0x0100000e) @ 0x1f7f6698
ACPI: dsdt (v001 HP dau00 0x00010000 MSFT 0x0100000e) @ 0x00000000
ACPI: PM-timer IO port: 0x1008
ACPI: Local APIC address 0xfec01000
ACPI: lapic (acpi_id [0x01] lapic_id [0x00] enabled)
Processor #0 6:13 APIC version 20
ACPI: lapic_nmi (acpi_id [0x01] High edge lint [0x1])
ACPI: ioapic (ID [0x01] address [0xfec00000] gsi_base [0])
Ioapic [0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
[[Email protected] ~] #
Http://www.linuxso.com/command/dmesg.html
Dmesg displays the boot information.