brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: dmesg -x labels every line with its facility and level

Dmesg
~/tips/tip-dmesg-decode-facility-level

sudo dmesg -x

See how serious each kernel message is, right in front of the line.

A plain kernel log gives every line the same weight. A harmless note and a real error look alike until you read them.

sudo dmesg -x

Each line now starts with two labels, for example kern :info :. The first is the facility, which says who produced the message, and the second is the level, such as info, warn or err.

That makes skimming easier, and it also tells you which names to feed to a filter. When I see that the lines I care about are marked warn, I narrow it down:

sudo dmesg -x --level=warn,err

It also explains odd entries. Not everything in the buffer comes from the kernel: boot tools and services can write to it, and they show up with another facility such as daemon or user. You can ask for one facility only:

sudo dmesg -x --facility=daemon

Take the labels as the author’s opinion. A driver developer picks the level, and some log routine events as errors while real trouble arrives as a warning or even as info. A few red looking lines at startup are normal on a lot of hardware. Judge them by whether something actually fails to work.

Further reading: dmesg man page

More Dmesg tips sudo dmesg -C sudo dmesg -r > kernel.raw sudo dmesg -n 4 sudo dmesg -T | tail -30 All Dmesg tips (5) All topics

Link