470 likes | 762 Views
Linux+ Guide to Linux Certification, Second Edition. Chapter 13 Troubleshooting and Performance. Objectives. Describe and outline common troubleshooting procedures Identify good troubleshooting practices Effectively troubleshoot common hardware-related problems
E N D
Linux+ Guide to Linux Certification, Second Edition Chapter 13 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 Linux+ Guide to Linux Certification, 2e
Objectives (continued) • Monitor system performance using command-line and graphical utilities • Identify and fix common performance problems • Understand the purpose and usage of kernel modules • Recompile and patch the Linux kernel Linux+ Guide to Linux Certification, 2e
Troubleshooting Methodology Figure 13-1: The maintenance cycle Linux+ Guide to Linux Certification, 2e
Troubleshooting Methodology (continued) • Monitoring: Observing system areas for problems or irregularities • Proactive maintenance: Minimizing chance of future problems • e.g., perform regular system backups Linux+ Guide to Linux Certification, 2e
Troubleshooting Methodology (continued) • Reactive maintenance: Correcting problems when they arise • Documenting solutions • Developing better proactive maintenance methods • Documentation: System information stored in a log book for future references • Troubleshooting procedures: Tasks performed when solving system problems Linux+ Guide to Linux Certification, 2e
Troubleshooting Methodology (continued) Figure 13-2: Common troubleshooting procedures Linux+ Guide to Linux Certification, 2e
Troubleshooting Methodology (continued) • Two troubleshooting golden rules: • Prioritize problems according to severity • Spend reasonable amount of time on each problem given its priority • Try to solve root of problem • Avoid missing underlying cause • Justify why a certain solution is successful Linux+ Guide to Linux Certification, 2e
Resolving Common System Problems • Two categories of problems: • Hardware-related • Software-related Linux+ Guide to Linux Certification, 2e
Hardware-Related Problems • Often involve improper hardware or software configuration • SCSI termination • Video card and monitor configuration • POST test alerts • Loose hardware connections • IRQ or I/O address conflicts • View output of dmesg command Linux+ Guide to Linux Certification, 2e
Hardware-Related Problems (continued) • Absence of device drivers prevent OS from using associated devices • Kudzu program: Detect and install support for new hardware • If hardware device not detected, device driver must be configured manually • HDDs most common device to fail • Good idea to use RAID Linux+ Guide to Linux Certification, 2e
Hardware-Related Problems (continued) Figure 13-3: The kudzu welcome screen Linux+ Guide to Linux Certification, 2e
Hardware-Related Problems (continued) Figure 13-4: Configuring new hardware using kudzu Linux+ Guide to Linux Certification, 2e
Hardware-Related Problems (continued) • If HDD containing partitions mounted on noncritical directories fails: • Power down computer and replace failed HDD • Boot Linux system • Use fdisk to create partitions on replaced HDD • Use mkfs to create filesystems • Restore original data • Ensure /etc/fstab has appropriate entries to mount filesystems Linux+ Guide to Linux Certification, 2e
Hardware-Related Problems (continued) • If HDD containing / filesystem fails: • Power down computer and replace failed HDD • Reinstall Linux on new HDD • Restore original configuration and data files Linux+ Guide to Linux Certification, 2e
Software-Related Problems:Application-Related Problems • Missing program libraries/files, process restrictions, or conflicting applications • Dependencies: Prerequisite shared libraries or packages required for program execution • Programs usually check at installation • Package files may be removed accidentally Linux+ Guide to Linux Certification, 2e
Software-Related Problems:Application-Related Problems (continued) • rpm –V command: Identify missing files in a package or package dependency • ldd command: Display shared libraries used by a program • ldconfig command: Updates /etc/ld.so.conf and /etc/ld.so.cache files Linux+ Guide to Linux Certification, 2e
Software-Related Problems:Application-Related Problems (continued) • /etc/ld.so.conf file: List of directories containing shared libraries • /etc/ld.so.cache file: Contains location of shared library files • compressor/decompressor (codec) file: Contains rules to compress or decompress multimedia information Linux+ Guide to Linux Certification, 2e
Software-Related Problems:Application-Related Problems (continued) • Filehandles: Connections that programs make to files • ulimit command: Modify process limit parameters in current shell • Can also modify max number of filehandles • /var/log directory: Contains most system log files • If applications stop functioning due to difficulty gaining resources, restart using SIGHUP Linux+ Guide to Linux Certification, 2e
Software-Related Problems:Operating System-Related Problems • Most software-related problems related to OS • Boot loader, filesystem, serial device problems • LILO problems: Place “linear” in, remove “compact” from /etc/lilo.conf file • GRUB problems: Typically result of missing files in /boot directory • mkbootdisk command: Create a boot floppy diskette Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) • If filesystem on partition mounted to noncritical directory becomes corrupted: • Unmount filesystem • Run fsck command with –f (full) option • If fsck command cannot repair filesystem, use mkfs command to re-create the filesystem • Restore filesystem’s original data Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) • If / filesystem is corrupted: • Boot from first Red Hat Fedora installation CD • Type “linux rescue” at welcome screen • Enter shell for Linux system on CD • Create new / filesystem via mkfs command • Restore original data to re-created / filesystem • Reboot system Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) Figure 13-5: The Red Hat Fedora Linux installation welcome screen Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) Figure 13-6: Obtaining a shell in rescue mode Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) Figure 13-7: The command-line shell used in rescue mode Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) • Knoppix Linux and BBC Linux: Bootable CD-based Linux distributions containing many filesystem repair utilities • setserial command: Set IRQ, I/O address, and speed of serial devices Linux+ Guide to Linux Certification, 2e
Software-Related Problems:OS-Related Problems (continued) Table 13-1: Common keywords used with the setserial utility Linux+ Guide to Linux Certification, 2e
Performance Monitoring • Jabbering: Failing hardware components send large amounts of information to CPU • Other causes of poor performance: • Software monopolizes system resources • Too many processes • Too many read/write requests to HDD • Rogue processes Linux+ Guide to Linux Certification, 2e
Performance Monitoring (continued) • Bus mastering: Peripheral components perform tasks normally executed by CPU • To increase performance: • Add RAM • Upgrade to faster HDDs • Disk Striping RAID • Decrease kernel size Linux+ Guide to Linux Certification, 2e
Performance Monitoring (continued) • Run performance utilities on a regular basis • Record results in a system log book • Eases identification of performance problems • Baseline: Measure of normal system activity Linux+ Guide to Linux Certification, 2e
Monitoring Performance with sysstat Utilities • System Statistics (sysstat) package: Common performance monitoring utilities • Multiple Processor Statistics (mpstat) utility: Displays CPU statistics • Input/Output Statistics (iostat) command: Displays block device input/output statistics • System Activity Reporter (sar) command: Displays various system statistics Linux+ Guide to Linux Certification, 2e
Monitoring Performance with sysstat Utilities (continued) Table 13-2: Common options to the sar command Linux+ Guide to Linux Certification, 2e
Monitoring Performance with sysstat Utilities (continued) • Large number of pages sent to and taken from swap partition: • Slower performance • Add RAM to resolve Linux+ Guide to Linux Certification, 2e
Other Performance Monitoring Utilities • free command: Displays memory and swap statistics • vmstat command: Displays memory, CPU, and swap statistics Linux+ Guide to Linux Certification, 2e
Customizing the Kernel • Options to provide additional hardware support or change existing hardware support: • Insert modules into kernel • Recompile kernel • Download and compile new kernel Linux+ Guide to Linux Certification, 2e
Kernel Modules • May insert device drivers and kernel features into the kernel as modules • Reduces kernel size • Good form to compile standard device support into the kernel • Leave support for other devices and features as modules • Modules typically stored in subdirectories of /lib/modules/<kernel-version> Linux+ Guide to Linux Certification, 2e
Kernel Modules (continued) • insmod command: Insert modules into kernel • modprobe command: Insert module and all necessary prerequisite modules into kernel • lsmod command: Lists modules currently used by kernel • Can also show module dependencies • rmmod command: Remove modules from kernel Linux+ Guide to Linux Certification, 2e
Kernel Modules (continued) • Modules usually inserted into kernel automatically at boot time using modprobe • /etc/modprobe.conf file: Used to load any alias modules at system startup Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel • Gain or remove hardware or kernel support • /usr/src/<kernel-version> directory: Contains Kernel source code for a specific distribution • Can download new kernel source code • /usr/src/linux directory: Contains Kernel source code • Symbolic link to /usr/src/<kernel-version> Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel (continued) • Make commands: Compilation-related tasks • Many types • make mrproper: Remove files created by previous kernel • make oldconfig: Record current kernel features and settings • make config: Prompts user for kernel configuration information • Text-based Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel (continued) • make menuconfig: Provides menus to select kernel configuration • make xconfig or make gconfig: Provide graphical interface to select kernel configuration • xconfig runs in KDE; gconfig runs in GNOME • make clean: Remove files not required for compilation Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel (continued) Figure 13-8: The make menuconfig interface Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel (continued) Figure 13-9: The make gconfig interface Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel (continued) Figure 13-10: Configuring power options in the Linux kernel Linux+ Guide to Linux Certification, 2e
Compiling a New Linux Kernel (continued) • make bzImage: Compile the kernel • Creates bzip2-compressed kernel • Copy to /boot directory • Rename as vmlinuz-<kernel version> • makemodules_install: Compile necessary modules and copy to appropriate location Linux+ Guide to Linux Certification, 2e
Patching the Linux Kernel • If not changing kernel version, can apply patches • Rather than download all kernel source code • Patch command: Supply a patch to kernel source code • Still need to recompile kernel Linux+ Guide to Linux Certification, 2e