General

Check Your Linux Kernel Log For Errors With ‘dmesg’

You can check your kernel logs for errors with dmesg, if you need to. I previously wrote an article about checking your error logs with KSystemLog and checking the error logs graphically is my preferred way to check for errors. KSystemLog also shows more than just kernel logs.

However, a GUI environment is not always an option and you can use ‘dmesg‘ in a pinch. This will only output the kernel ring buffer. There are other other error logs, so this is just one way. Future articles will cover ways to read other logs.

The ‘dmesg’ application stands for ‘diagnostic message’ and prints the ring buffer from the kernel. Run by itself, it’ll output  a ton of information, so this article will also help you try to make sense of the output.

If you’re curious, the man page defines dmesg as:

dmesg – print or control the kernel ring buffer

And, well, that’s what it does. It does what it says on the tin. The buffer it’s reading is full of information, messages the kernel has left. Not all that information is about errors, but in those messages are error notifications.

Running dmesg by itself is likely a bit overwhelming. Feel free to try it out right now. Crack open your terminal, just press CTRL + ALT + T, and enter the following:

dmesg

The output is way more information than you probably want to wade through – especially while being frustrated. So, let’s see if we can make this data more useful.

Read Error Messages With ‘dmesg’:

I hope you opened your terminal in the entry section. If you didn’t, you should do so now. Go ahead and open it, I’ll wait here until you’re back…

We already know that running dmesg by itself throws a ton of output. It’s the data in the kernel ring buffer and it’d be exhausting to go through it line by line.

So, first, if you’re checking the logs then there’s likely a reason. That reason will help you with this next command. You’ll need a pipe and grep so that you can process the output more easily. Let’s say you’re having monitor issues, which would lead you to try:

dmesg | grep "HDMI"

You can grep for other things, such as “Audio” or even “Mouse”. Go ahead and give those a try. You may have errors you don’t even know about.

Most of the time, dmesg is pretty uninteresting. You can actually filter it further, often to just a few lines – by just showing the lines that contain errors. To do that, just try:

dmesg --level=err

If you want to clear out the logged data, you can do that easily enough. You will need to use sudo, and the command is:

sudo dmesg -C

Those are really the most important aspects of checking your logs for errors with dmesg. You can run man dmesg to learn about a few more options. As far as my experience goes, you won’t really have a need for the other flags.

Again, I wrote an article about KSystemLog and that will graphically show you your logs – including the kernel’s buffer. If you have a choice, you might as well use a GUI for this sort of thing.

Closure:

Yup… There’s another article. It’s one more step towards reaching my goal. Before we know it, that year will have passed and I’ll need to make some decisions. Until then, let’s keep the party rocking.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Enable/Disable Your Network Interface

Today we'll cover one way to enable or disable your network interface in the Linux…

6 months ago

Check Your NIC Speed In The Terminal

Today's exercise is a nice and simple exercise where we check your NIC speed in…

6 months ago

Easily Monitor Your Wireless Connection

Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…

6 months ago

Count The Files In A Directory

I think I've covered this before with the ls command but this time we'll count…

6 months ago

Get System Information With The ‘uname’ Command In Linux

Today we'll be learning about a basic Linux command that's known as 'uname' and it…

6 months ago

hardinfo Has Been Rebooted As hardinfo2

If you've used hardinfo in the past, it may interest you to know that hardinfo…

6 months ago