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:

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:

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:

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:

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.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!
icon

Author: 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.