How to Troubleshoot Using Dmesg

Linux logs can reveal important information about your server. For system boot messages, the dmesg command provides quick and easy access to critical kernel information. When all is going well, you might not spend much time with dmesg, but when something goes wrong, it is an invaluable troubleshooting tool.

If you need to see boot information in general, you can just browse through dmesg with the “more” command:

dmesg | more

You will see output like this:

[ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pag

es: 1021036

[ 0.000000] Policy zone: Normal

[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-29-generic ro

ot=UUID=a915bcbb-d237-41d0-a825-cb0d45c4045f ro quiet splash nomodeset vt.handof


[ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)

[ 0.000000] xsave/xrstor: enabled xstate_bv 0x7, cntxt size 0x340

If you only need to view information about system memory, type:

dmesg| grep Memory

Output will look like:

[ 0.000000] Memory: 3988424k/4702208k available (6555k kernel code, 544572k absent, 169212k reserved, 6645k data, 920k init)

If you need to know the exact time when an event listed in dmesg occurred, you will not be able to see it within the dmesg file, but you can access the kern.log file to get the timestamp. For example, if you want to see information about L2 cache, you would type:

grep “L2 cache” kern.log.1

For some operating systems, you may also be able to use the command “dmesg -T” to see human-readable timestamps. Alternatively, linuxaria has a nice script to make the timestamps readable.