Troubleshooting and Performance Chapter Fourteen Troubleshooting and Performance
Objectives Describe and outline common troubleshooting procedures Identify good troubleshooting practices Effectively troubleshoot common hardware-related problems Effectively troubleshoot common software-related problems Monitor system performance using command-line and graphical utilities Understand the purpose and usage of kernel modules
Troubleshooting Methodology Figure 14-1: The maintenance cycle
Troubleshooting Methodology Monitoring Process by which system areas are observed for problems or irregularities Proactive maintenance Measure taken to reduce future system problems Reactive maintenance Measure taken when system problems arise
Troubleshooting Methodology Documentation System information that is stored in a log book for future references Troubleshooting procedures The tasks performed when solving system problems
Troubleshooting Methodology Figure 14-2: Common troubleshooting procedures
Troubleshooting Methodology Two golden rules to guide you during any troubleshooting process: Prioritize problems Prioritize the problems according to severity and spend a reasonable amount of time on each problem given its priority Try to solve the root of the problem To avoid missing the underlying cause of any problem, try to justify why a certain solution is successful
Hardware-Related Problems Figure 14-3: The KDE Control Center
Hardware-Related Problems The absence of a device driver will also prevent the operating system from using the associated hardware devices Kudzu program Program used to detect and install support for new hardware
Hardware-Related Problems Figure 14-4: The kudzu welcome screen
Hardware-Related Problems Figure 14-5: Configuring new hardware using kudzu
Hardware-Related Problems If the hard disk that contains the / filesystem fails, then perform the following steps: Power down the computer and replace the failed hard disk Reinstall Linux on the new hard disk Restore the original configuration and data files using a back-up utility
Software-Related Problems: Application-Related Problems Dependencies The prerequisites required for program execution such as shared libraries or other packages ldd command Command used to display the shared libraries used by a certain program
Software-Related Problems: Application-Related Problems ldconfig command Command that updates the /etc/ld.so.conf and /etc/ld.so.cache files /etc/ld.so.conf files File that contains a list of directories that contain shared libraries /etc/ld.so.cache file File that contains the location of shared library files
Software-Related Problems: Application-Related Problems Filehandles Connection that a program makes to files on a filesystem unlimit command Command used to modify process limit parameters in the current shell /var/log directory Directory that contains most system log files
Software-Related Problems: OS-Related Problems Most software-related problems are related to the operating system itself These typically involve problems with boot loaders, filesystems, and serial devices mkbootdisk command Command used to create a boot floppy diskette
Software-Related Problems: OS-Related Problems Figure 14-6: The Red Hat Linux installation welcome screen
Software-Related Problems: OS-Related Problems Figure 14-7: Obtaining a shell in rescue mode
Software-Related Problems: OS-Related Problems Figure 14-8: The command-line shell used in rescue mode
Software-Related Problems: OS-Related Problems Table 14-1: Common keywords used with the setserial utility
Performance Monitoring Jabbering Process by which failing hardware components send large amounts of information to the CPU Bus mastering Process by which peripheral components perform tasks normally executed by the CPU
Performance Monitoring To ease identification of performance problems, you should run performance utilities on a healthy Linux system on a regular basis during normal business hours and record results in a system log book Baseline A measure of normal system activity
Monitoring Performance with sysstat Utilities System Statistics (sysstat) package Software package that contains common performance monitoring utilities such as mpstat, iostat, sar, and isag Multiple Processor Statistics (mpstat) utility Command that displays CPU statistics
Monitoring Performance with sysstat Utilities Input/Output Statistics (iostat) command Command that displays Input/Output statistics for block devices System Activity Reporter (sar) command Command that displays various system statistics
Monitoring Performance with sysstat Utilities Table 14-2: Common options to the sar command
Monitoring Performance with sysstat Utilities Table 14-2 (continued): Common options to the sar command
Monitoring Performance with sysstat Utilities If there are a large number of pages being sent to and taken from the swap partition, then the system will suffer from slower performance To remedy this, you could add more physical memory (RAM) to the system Interactive System Activity Grapher (isag) command Command used to graph system performance information stored in the /var/log/sa directory
Monitoring Performance with sysstat Utilities Figure 14-9: Choosing a file to view using the System Activity Grapher
Monitoring Performance with sysstat Utilities Figure 14-10: Choosing statistics using the System Activity Grapher
Monitoring Performance with sysstat Utilities Figure 14-11: Viewing user statistics using the System Activity Grapher
Other Performance Monitoring Utilities free command Command used to display memory and swap statistics vmstat command Command used to display memory, CPU, and swap statistics
Kernel Modules Many device drivers and kernel features are compiled into the kernel However, these may also be inserted into the kernel as modules to reduce the size of the kernel It is good form to compile standard device support into the kernel and leave support for other devices and features as modules
Kernel Modules insmod command modprobe command lsmod command Command used to insert a module into the Linux kernel modprobe command Command used to insert a module and all necessary prerequisites modules into the Linux kernel lsmod command Command that lists modules currently used by the Linux kernel
Kernel Modules rmmod command /etc/modules.conf file Command that removes a module from the Linux kernel /etc/modules.conf file File used to load and alias modules at system initialization /etc/rc.d/rc.local file File used to load modules at system initialization
Compiling a New Linux Kernel To gain certain hardware or kernel support, it may be necessary to recompile the current kernel with different features or download the source code for a newer kernel and compile it /usr/src/linux The directory that contains source code for the Linux kernel during compilation
Compiling a New Linux Kernel Figure 14-12: The make menuconfig interface
Compiling a New Linux Kernel Figure 14-13: The make xconfig interface
Compiling a New Linux Kernel Figure 14-14: Configuring code maturity level options
Compiling a New Linux Kernel Figure 14-15: Configuring USB support
Patching the Linux Kernel To install a more current Linux kernel version, you normally download the source code for that kernel and place it in a directory that will be referenced by /usr/src/linux Patch command Command used to supply a patch to the Linux kernel source code
Chapter Summary After installation, Linux administrators monitor the system, perform proactive and reactive maintenance, and document important system information Common troubleshooting procedures involve collecting data to isolate and determine the cause of system problems, as well as implementing and testing solutions that can be documented for future use System problems may be categorized as hardware- or software-related
Chapter Summary IRQ conflicts, invalid hardware settings, absence of kernel support, and hard disk failure are common hardware-related problems on Linux systems Software-related system problems may be further categorized as application-related or operating system-related System performance is affected by a variety of hardware and software factors
Chapter Summary Using performance monitoring utilities to create a baseline is helpful when diagnosing performance problems in the future System features and hardware support may be compiled into the Linux kernel or provided by a kernel module You may compile a Linux kernel with only the necessary features and support in order to increase system performance