► /etc/modprobe.conf — This is not a command, but a file that controls how modprobe and depmod behave; it contains kernel module variables. Although the command syntax can be quite complex, most actual needs are very simple. The most common use is to alias a module and then pass it some parameters. For example, in the following code, a device name (from devices.txt) is aliased to a more descriptive word and then some information is passed to an associated module. The i2c-dev device is used to read the CPU temperature and fan speed on the system. These lines for /etc/modprobe.conf were suggested for use by the program's documentation. They were added with a text editor.
alias char-major-89 i2c-dev
options eeprom ignore=2,0x50,2,0x51,2,0x52
A partial listing of lsmod is shown here, piped through the less command, so that you can view it a page at a time:
# lsmod | less
Module Size Used by
parport_pc 19392 1
lp 8236 0
parport 29640 2 parport_pc,lp
autofs4 10624 0
sunrpc 101064 1
The list is actually much longer, but here you can see that the input module is being used by the joydev (joystick device) module, but the joystick module is not being used. This computer has a joystick port that was auto-detected, but no joystick is connected. A scanner module is also loaded, but because the USB scanner is unplugged, the module is not being used. You would use the lsmod command to determine whether a module was loaded and what other modules were using it. If you examined the full list, you would see modules for all the devices attached to your computer.
To remove a module, joydev in this example, use
# rmmod joydev
or
# modprobe -r joydev
A look at the output of lsmod would now show that it is no longer loaded. If you removed input as well, you could then use modprobe to load both input and joydev (one depends on the other, remember) with a simple:
# modprobe joydev
If Fedora were to balk at loading a module (because it had been compiled using a different kernel version from what you are currently running; for example, the NVIDIA graphics card module), you could force it to load like this:
# insmod -f nvidia
You would ignore the complaints (error messages) in this case if the kernel generated any.
Chapter 7, "Multimedia," talked about loading a scanner module; in the example there, the scanner module was loaded manually and the vendor ID was passed to it. The scanner was not included in the lookup list because it is not supported by the GPL scanner programs; as a result, the scanner module was not automatically detected and loaded. However, the scanner works with a closed-source application after the module is loaded. Automatic module management is nice when it works, but sometimes it is necessary to work with modules directly.
When to Recompile
Fedora systems use a modified version of the plain vanilla Linux kernel (a modified version is referred to as a patched kernel) with additional drivers and other special features compiled into it.
Fedora has quite an intensive testing period for all distribution kernels and regularly distributes updated versions. The supplied Fedora kernel is compiled with as many modules as possible to provide as much flexibility as possible. A running kernel can be further tuned with the sysctl program, which enables direct access to a running kernel and permits some kernel parameters to be changed. As a result of this extensive testing, configurability, and modularity, the precompiled Fedora kernel does everything most users need it to do. Most users need to recompile the kernel only to
► Accommodate an esoteric piece of new hardware.
► Conduct a system update when Fedora has not yet provided precompiled kernels.
► Experiment with the system capabilities.
Fedora supplies several precompiled versions of the kernel for Athlon and Pentium processors, for single- and multi-processor motherboards, and for Enterprise-class systems (higher security; uses 4GB of memory). These kernel versions are provided in RPM format. Installing them is as easy as:
# rpm -Uvh new_kernel.rpm
The kernel (but not the source) RPM files include installation scripts that automatically alter your bootloader configuration, making the new kernel the default. If you do not want that to happen, just manually edit the /etc/lilo.conf or /boot/grub/grub.conf files and change them back.
You should always rpm -U (upgrade) a new kernel rpm, rather than rpm -i (install), to avoid overwriting the old, but still working, kernel. This is done as a safety measure. What if the new one does not work?
Kernel Versions
The Linux kernel is in a constant state of development. As new features are added, bugs are fixed, and new technology is incorporated into the code base, it becomes necessary to provide stable releases of the kernel for use in a production environment. It is also important to have separate releases that contain the newest code for developers to test. To keep track of the kernels, version numbers are assigned to them. Programmers enjoy using sequential version numbers that have abstract meaning. Is version 8 twice as advanced as version 4 of the same application? Is version 1 of one application less developed than version 3 of another? The version numbers cannot be used for this kind of qualitative or quantitative comparison. It is entirely possible that higher version numbers can have fewer features and more bugs than older versions. The numbers exist solely to differentiate and organize sequential revisions of software.
For the latest development version of the kernel at the time of writing, for example, the kernel version number is 2.6.22.
The kernel version can be broken down into four sections:
► major version — This is the major version number, now at 2.
► minor version — This is the minor version number, now at 6.
► sublevel number — This number indicates the current iteration of the kernel; here it is number 10.
► extraversion level — This is the number representing a collection of patches and additions made to the kernel by the Red Hat engineers to make the kernel work for them (and you). Each collection is numbered, and the number is indicated here in the kernel name. From the preceding example, it is 1 .
Typing uname -r at the command prompt displays your current kernel version:
# uname -r
2.6.10-1
Even-numbered minor versions are stable kernels, whereas odd-numbered minor versions are development releases. Version 2.6.x is the stable production kernel, whereas version 2.5.x is the development Linux kernel. When a new version of the development kernel is started, it will be labeled 2.7.x.