Identifying and diagnosing hardware related problems on a Linux machine is within the ability of most computer users through the use of built-in Linux logging and reporting features. A productive hardware diagnostic procedure might include the following steps :

  • Identifying existing hardware and drivers
  • Examining log files for errors and warnings
  • Researching community provided solutions
  • Researching vendor provided solutions

Common steps to remedy hardware issues include replacing defective or failing hardware, and updating or modifying the Linux installation based on information discovered through the above diagnostic steps.

Identifying Hardware

The following discovery techniques use tools common to Ubuntu Linux distributions. The tools described here are not unique to Ubuntu Linux and may be available on other Unix-like operating systems. These tools are invoked from a ‘Command Line Interface’ – abbreviated as CLI. Most Ubuntu users will want to issue these commands from the default Ubuntu CLI (gnome terminal), often accessed from the Applications menu.

lspci – List PCI Devices/Drivers

lspci is a command that prints detailed information about all PCI devices present in a computer system. PCI devices are those that comply with the PCI specifications developed by PCISIG to standardize the method of communication between a CPU and attached components.

 

“Peripheral component interconnect (PCI) delivers I/O functionality for computers… The PCI standard is defined for chip-level interconnects, adapter cards and device drivers.” http://www.pcisig.com/membership/about_us/

 

lspci is based on the common portable library libpci, which offers access to the PCI configuration space on a variety of operating systems. The information gathered through the use of the lspci command can be used to quickly identify manufacturers, models, drivers, and modules related to core hardware components. Several common uses of lspci are represented here:

Access lspci manual:

man lspci

Print pci devices (sample output shown). Add -v for verbose, -vv for very verbose output, or -vvv for even more:

lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 0a)
00:01.0 PCI bridge: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port (rev 0a)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3450
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10)
03:02.0 Ethernet controller: D-Link System Inc DGE-530T Gigabit Ethernet Adapter (rev 11) (rev 11)

Print kernel drivers for each device. This functionality is not available on pre 2.6 series Linux kernels. Information appearing after the ‘Kernel modules’ tags indicates the names of kernel modules capable of interacting with the hardware (often more than one).

lspci -k
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 0a)
	Kernel modules: intel-agp
00:01.0 PCI bridge: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port (rev 0a)
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
	Kernel driver in use: HDA Intel
	Kernel modules: snd-hda-intel
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
	Kernel driver in use: ehci_hcd
	Kernel modules: ehci-hcd
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
	Kernel modules: iTCO_wdt, intel-rng
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
	Kernel driver in use: PIIX_IDE
	Kernel modules: ata_generic, ide-pci-generic, piix
00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
	Kernel driver in use: ata_piix
	Kernel modules: ata_generic, ata_piix, ide-pci-generic
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
	Kernel driver in use: i801_smbus
	Kernel modules: i2c-i801
01:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3450
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10)
	Kernel driver in use: tg3
	Kernel modules: tg3
03:02.0 Ethernet controller: D-Link System Inc DGE-530T Gigabit Ethernet Adapter (rev 11) (rev 11)
	Kernel driver in use: skge
	Kernel modules: skge

 

lsusb – List USB Devices

lsusb is a command that prints information about USB devices that are attached to a system. USB devices are those that communicate via the Universal Serial Bus Standards, as maintained by the USB-IF. Numerous common peripherals including computer mice, keyboards, printers, solid state storage devices, and scanners can use USB to connect and communicate with a computer.

lsusb allows inspection not only of the devices that are plugged into a machine, but also of their configurations as shown below. As lsusb -v and -D modes are extremely verbose, sample results are not included for the -v or single device detail via -D:

Access lsusb manual

man lsusb

List attached USB devices. Sample output shown:

lsusb
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 003: ID 413c:3012 Dell Computer Corp. 
Bus 004 Device 002: ID 413c:2105 Dell Computer Corp. 
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

View a quick list of types of attached USB devices. Sample output shown:

sudo lsusb -v | grep “^Bus\|iProduct”
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  iProduct                2 EHCI Host Controller
Bus 004 Device 003: ID 413c:3012 Dell Computer Corp. 
  iProduct                2 Dell USB Optical Mouse
Bus 004 Device 002: ID 413c:2105 Dell Computer Corp. 
  iProduct                2 Dell USB Keyboard
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  iProduct                2 UHCI Host Controller
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  iProduct                2 UHCI Host Controller
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  iProduct                2 UHCI Host Controller
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  iProduct                2 UHCI Host Controller

Utilize bus and device numbers to access extensive detail regarding a single device. sudo is required to access all desired information. Format is: sudo lsusb -D /proc/bus/usb/<bus#>/<dev#>

sudo lsusb -D /proc/bus/usb/004/003

Identify single product type quickly using lsusb and grep. Sample output shown:

sudo lsusb -D /proc/bus/usb/004/003 | grep iProduct
  iProduct                2 Dell USB Optical Mouse

 

Examining Log Files

This section is in the process of being expanded.

dmesg

dmesg (for “display message”) is a command on some Unix-like operating systems that prints the message buffer of the kernel.

When the computer system is initially booted the kernel is loaded into memory. At this stage each device driver present in the kernel probes the system for the existence of relevant hardware. If the hardware is located, a diagnostic message is produced documenting precisely what was found. Other elements within the kernel may also produce similar output reporting both the presence of that particular module, and the values of any parameters adopted. It may be possible to specify boot parameters which control the level of detail in the messages. This process typically happens at a speed where individual messages scroll off the top of the screen before they can be read. Some keyboard keys may pause the screen output. The dmesg command allows these messages to be reviewed in a controlled manner after the system has started.

Save a copy of this output into your home directory for analysis as follows:

sudo dmesg > ~/dmesg.txt

 

syslog

Syslog can be checked for a range of system related errors and warning. Copy the file to a safe place with a descriptive extension before analysis, then change file ownership to gain access:

sudo cp -v /var/log/syslog ~/syslog.101409
sudo chown <username> ~/syslog.101409

 

messages

Generally speaking logrotate rotates the messages log every set number of days (usually 1). Its contents appear in two forms , one as a generally viewable file with a text editor and a gzipped version (.gz) compressed for storage sake.

Copy the file to a safe place with a descriptive extension before analysis, then change file ownership to gain access:

sudo cp /var/log/messages ~/messages.101409
sudo chown <username> ~/messages.101409

 

Community Solutions

Soon to host a brief description of Ubuntu related information sources including common community destinations for hardware information.

Vendor Solutions

Soon to host a brief description of Open Source resources provided by large hardware manufacturers and a brief list of free registration OEM resources being compiled by Aesis.

Conclusion

With this data collected, determining what is failing or not working should be fairly easy. This article will soon be expanded to include brief snippets of logs showing common activity. Check back if you have been log reading and need to know who MARK is and why he is writing in your logs.