Today, get started with your RHCE certification. Learn about shell configuration files, setting up and managing disk quotas, and the basics of the kernel. This comes from chapter five of Red Hat Certified Engineer Linux Study Guide (Exam RH302), fourth edition, by Michael Jang. (McGraw-Hill/Osborne, 2004, ISBN: 0-07-225365-7).
All kernel modules are stored in the /lib/modules/kernel_version/ directory. When RHEL 3 is installed, kernel_version=2.4.21-4.EL. If you have recently compiled a new kernel and your modules are not loading properly, then you have probably forgotten to compile and install the modules. In the /usr/src/kernel_version source directory, run the following commands:
# make modules # make modules_install
The first line compiles the modules, while the second places them under the proper directory tree. In this directory tree, different subdirectories represent different groupings. The following is a sample of a module directory:
# ls -l /lib/modules/2.4.21-4.EL/kernel/drivers total 60 drwxr-xr-x 7 root root 4096 Oct 23 15:22 addon drwxr-xr-x 2 root root 4096 Oct 23 15:22 block drwxr-xr-x 2 root root 4096 Oct 23 15:22 cdrom drwxr-xr-x 8 root root 4096 Oct 23 15:22 char drwxr-xr-x 2 root root 4096 Oct 23 15:22 ide drwxr-xr-x 2 root root 4096 Oct 23 15:22 input drwxr-xr-x 2 root root 4096 Oct 23 15:22 md drwxr-xr-x 3 root root 4096 Oct 23 15:22 message drwxr-xr-x 10 root root 4096 Oct 23 15:22 net drwxr-xr-x 2 root root 4096 Oct 23 15:22 parport drwxr-xr-x 2 root root 4096 Oct 23 15:22 pcmcia drwxr-xr-x 5 root root 4096 Oct 23 15:22 scsi drwxr-xr-x 5 root root 4096 Oct 23 15:22 sound drwxr-xr-x 5 root root 4096 Oct 23 15:22 usb drwxr-xr-x 3 root root 4096 Oct 23 15:22 video
Remember that each /lib/modules/kernel_version directory contains a modules.dep file that lists all the dependencies for all the modules within the directories. Each of these module directories includes a group of kernel modules for a common type of hardware. You might want to become familiar with where to find certain modules when needed. Here are some module types you can find under each directory:
addon High-end cards such as for server racks
block Block devices: parallel port ide drives, network block devices, XT disks, hardware raid devices
cdrom Non-ATAPI CD-ROM drivers: Mitsumi, Sony
char Miscellaneous input and serial devices
ide Hard disk drivers
input Input devices (keyboards, mice)
md raid devices
message Specialized I/O adapters
net Network modules: basic network cards, generic ppp, slip
parport Parallel port devices (not printers)
pcmcia Drivers used by the pcmcia cardmgr daemon (the actual cards use separate drivers)
scsi SCSI tape, RAID, and hard drive modules, video (special video modules for Linux)
sound Sound adapters
usb Universal Serial Bus hubs and devices
video Graphics adapters
All modules have .o for an extension (such as pcnet32.o). You do not need to specify the full name, just the first part of the module file (pcnet32). Once you know the directory structure, you can have the modprobe command load all modules for a certain category. For instance, if you are on a PC and you don’t know the network card, you can simply type
modprobe -t net
This will attempt to load all modules in /lib/modules/kernel_version/net, stopping when a match is found. To remove a module such as pcnet32 and all its dependencies, you can type either
modprobe -r pcnet32
or
rmmod -r pcnet32
Either of these commands will remove the modules and all their dependencies, provided they are not in use by another module or not currently active. For example, if your network is active, you can’t remove the network pcnet32 driver module. If you want to remove only the module and leave the other dependent drivers, run the rmmod command without the -r switch.
This is part one from the fifth chapter of Red Hat Certified Engineer Linux Study Guide (Exam RH302), fourth edition, by Michael Jang. (McGraw-Hill/Osborne, 2004, ISBN: 0-07-225365-7). Check it out at your favorite bookstore today. Buy this book now.