Tag: diagnosis
Simple Fault Diagnosis in Ubuntu
by Matt on May.23, 2009, under linux, programming, ubuntu
Every so often people ask for help and are not sure where the problem lies. When diagnosing problems in Ubuntu, and some of these tips should apply to other linux distros as well, there are a few places you should look at.
System Log Files
Linux distributions have fantastic logging capabilities built in. If there is a hardware fault it will more than likely appear in the system log. The most useful log files are kept in /var/log/ and can be accessed directly or through the Log File Viewer (System -> Administration -> Log File Viewer.)

System Log Viewer
The one thats most useful is the dmesg log. This can be found in the log viewer or on the command line by typing dmesg. There’s normally lots of information here and depending on what the fault is with depends on what’s not working. If you have a non-functional USB peripheral, like a USB wifi card or a printer, a look at what dmesg says before it’s plugged in and after it’s plugged in can supply you with some information to start hitting google, the mailing lists or IRC with. Sometimes it will tell you what needs to be done, for example I have stuck a dodgy memory stick in one machine which didn’t automount, dmesg quite happily told me the stick had errors and to check it. Fantastic!
The Tops
Is something slowing your machine down to a crawl? There are a few tools that can help here, largley from the “top” family of applications. Starting with the ones that are graphical, you can use the System Monitor (System -> Administration -> System Monitor) and have a look under the processes tab to see which process is eating the most cpu. Easy peasy.
The next one is top itself. Open a terminal and type “top”. This gives us a nice list of running processes and how much cpu/memory it’s using and its pid (process id). You can kill processes by hitting k and then typing in the pid.
The main reason I introduce people to top is because it is installed by default on most distros. A better version is htop, which while still in the terminal, is much easier to read.
As you can see, it gives you all the info top gives you, but in a slightly nicer, more intuitive layout. What if somethings really giving your hard drive a bad time? Want to find out what process is doing that, simply install iotop (sudo apt-get install iotop).
This gives a list of the processes running on the machines, who’s running it and how much io it’s using.
Other Useful Things to Know
Along with these diagnosis tools, there are also a few tools which can identify what hardware is connected to your machine. These are all in the terminal, and are “lspci”, “lsusb” and “lsmod”. These will give you a list of hardware connected to a pci like adapter, a usb like adapter and the modules loaded into your running kernel. If you’re asking for help somewhere, you will more than likely be asked for the information from one of these.
Rounding Up
The purpose of giving access to all this information is because diagnosis is half way to a fix. If you know what is causing the problem you know where to start looking, and what to start google-ing for. Hopefully this post will be helpful to someone
I’ll write a few more in the future going into a bit more depth into each of the commands listed, but a useful place to find more info on them is in their man pages, in a terminal simply run “man <command>” where<command> is the command you’re running.



