Ubuntu – Tools to diagnose Ubuntu problems


Over time a user will have several problems with Ubuntu as any other OS in the world. What tools and terminal commands exist in Ubuntu to help diagnose how the problem occurred and help solve it if it can be done.

Problems like:

  • Ubuntu Freezes after X time or when using Y app
  • Ubuntu rebooted/hibernated/suspended all by itself
  • Ubuntu not showing video or video has problems
  • Ubuntu not making any sound or sound has problems
  • Ubuntu not reading X drive (Pen drive, Internal Drive, External Drive…)
  • Ubuntu slow
  • Ubuntu not working with X hardware when connected
  • Ubuntu network problem

Normally there is a couple of GUI tools or Terminal commands that Ubuntu experts typically mention first to use to do a first diagnosis of this. What GUI tools (in case the problem is not related to video or limits the user from using the GUI) and Terminal commands (In case GUI is not working) can a user use to diagnose and help himself to how to find/fix the problem.

Best Answer

Since error logs are one of the most common tools to diagnose issues, tail -f logfile can be a very helpful command - if the behavior can be repeated. Many errors are logged to /var/log/Xorg.0.log and ~/.xsession-errors while running X; errors in X itself to the first, and errors in programs running inside of X to the second. While opening the log file in a text editor may be possible, watching the log file in an open terminal with this command allows the user to see the last ten lines logged, followed by any errors as they are added to the log in realtime, allowing a user to more easily associate error messages with the issue needing troubleshooting. A user can simply 'tail' a log file, and then try to reproduce the error, watching for new lines to appear. Since this command will run forever, Ctrl-C can be used to return to a prompt. Other logs can be helpful to watch, such as /var/log/dmesg for messages from the kernel, for example, relating to USB devices as they are plugged in, hard disk failures, and other hardware issues. Many times just searching the internet for a particular logged error can point a user to others who have documented the same issue, or help provide specifics to those trying to help.