I am intermediate Linux user which has basic knowledge of programming (c, perl, js ...) and some system troubleshooting (strace, SystemTap, lsof ...) and I am tired of Googling the messages which comes to Linux logs (/var/log/messages). I would like to improve my Linux kernel knowledge. Since Linux (and it's utilities like ssh etc.) is open source there are source codes available somewhere. So my question is: How can I troubleshoot/debug Linux problems on source code level? Is this even possible for intermediate Linux user? Where to begin and how to improve my programming skills and Linux kernel knowledge this way?
-
1If I stumble over a tool's log message I do not already know, my first look is into the tools docs ... - if I see kernel messages, I start to sweat ... - at least on production systems! ;-) – alk May 22 '13 at 17:43
-
2Re asking why it was closed -- you're unlikely to get an answer by editing the question. More likely to get one if you post on http://meta.stackoverflow.com/, which is the site for discussing stuff that goes on here. All that said, I'll try to answer you: questions asking about "resources, experiences and best practices" do tend to get closed here, because SO is intended to answer questions that have a direct and correct answer; questions that require discussion or invite opinions rather than facts aren't considered valid for SO. – Spudley May 23 '13 at 14:48
-
Well, Andrew is a moderator so he was probably following flags and other close votes. All of the closer have a sum total of about 11 upvotes for [tag:linux-kernel]. That said, I have seen better questions closed and you probably got all the answers you are going to get. The question is hard to answer definitely as Spudley points out. – artless noise May 24 '13 at 01:14
3 Answers
Honestly, Goole will always be your best bet for specific requests.
But if you want theoretical knowledge, read books (or the ebook equivalent that you can find ... on Google). Best of luck.

- 11,975
- 4
- 53
- 85
The Linux kernel cross reference might be helpful. You can browse the source by clicking links.
Try it here (there are other URLs, but I find this one most reliable from my location):

- 1,041
- 2
- 22
- 26
-
I was going to say this but it's already here. This site amounts to online csearch. You may find it more intermediate-friendly than cloning the source (as artless suggests). – Robert Martin May 22 '13 at 18:32
Use a git clone of the Linux source's stable tree.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Your version will be tagged; run git tag
in the directory. Checkout that version, for example git checkout v3.4.45
. Then you may run git grep *log message*
. You may get no hits, so you can trim the string until you do. For instance, numbers, driver and module names are often in a format string.
Kernel messages will usually have printk
, dev_err
, BUG
, etc. in the source. Often you will be able to tell from lsmod
whether a module is present in your system or not. The module names and source files usually match. So you get a clue as to whether the code is present in your system.

- 21,212
- 6
- 68
- 105
-
Or if you don't use a *stock* Linux, then you need a copy from your vendor and can use `grep` and `find` to do the same thing. – artless noise May 22 '13 at 18:20