Red Hat makes it easy to upgrade a kernel. If you re willing to use the stock Red Hat packaged kernel RPM, you can install the next version of your kernel with little trouble.
Furthermore, if you install a Red Hat kernel RPM, the new kernel is added to your bootloader as if it were a different operating system. If you have problems with the new kernel, all you need to do is reboot and select the older kernel in your bootloader.
While you might be used to upgrading RPMs, it s best to install the latest kernel RPM. Yes, that means you ll have two Linux kernels installed, side by side. One example is shown in Figure 12.1. RPMs on this network are mounted on the /mnt/source directory.
As you can see, higher kernel versions sometimes require you to upgrade and even temporarily remove other packages. Upgrades are riskier, because it s more difficult to go back. However, none of these packages are as essential to Linux as the kernel. So in the worst case, you can remove the upgraded packages and then reinstall the original RPMs.
Several Red Hat kernel-* RPMs are available, and they can be customized by CPU. Red Hat Linux kernel RPM files are organized in the following format:
kernel- versionnumber.cputype .rpm
Red Hat customizes kernels for the CPU types shown in Table 12.1. Red Hat may not provide the latest Linux kernel in RPM format customized for your CPU. To find your cputype , use the following command:
# uname -p
Note | For the rest of this chapter, I ll substitute x for versionnumber in files and directories. |
CPU type | Description |
---|---|
alpha | From the HP alpha CPU, developed by the former Digital Equipment Corporation |
athlon | For the AMD Athlon CPU |
i386 | Generic Intel kernel, good for i386, i586, and i686 CPUs |
i586 | Intel 586 CPU |
i686 | Intel 686 CPU |
ia64 | Intel Itanium 64-bit CPU |
ppc | Power PC CPU |
ppc64 | Power PC, 64-bit CPU |
s390 | Specialty CPU for an IBM server |
s390x | A 64-bit version of the s390 |
sparc | Developed by Sun Microsystems, primarily for the Solaris operating system |
Note | Keep good records of the RPMs you ve installed. Start with /root/install.log , which is a list of RPMs installed when you installed Red Hat Linux on your computer. |
It s easy to install a new kernel RPM. Typical steps are illustrated in Figure 12.1. The commands that you use will likely be different. For example, if the kernel RPM filename is kernel-2.4.22.i686.rpm , located in the /mnt/source directory, just run the following command:
# rpm -ivh /mnt/source/kernel-2.4.22.i686.rpm
If you see the Failed dependencies error shown in Figure 12.1, install packages listed in your error message first. The actual packages that you may need to install or upgrade will depend on the requirements of the new kernel and what you already have installed.
When you install another kernel, you re installing several files in the /boot directory. These files are stored side by side with files associated with your old kernel. These files are summarized in Table 12.2.
File | Description |
---|---|
config-* | Kernel configuration file |
initrd-* | Initial RAM disk; allows the kernel access to drivers at the start of the boot process |
module- info -* | A list of available hardware modules for this kernel |
System-map-* | A memory map with different functions |
vmlinux-* | The kernel |
vmlinuz-* | A compressed version of the kernel |
And that s it! Your new kernel is automatically installed. Wasn t that easy? In the next section, you ll see what the newly installed kernel does to your bootloader.
The Red Hat Linux kernel RPMs automatically update your active bootloader, whether it be GRUB or LILO. Detailed information on each bootloader is available in Chapter 11 . A revised grub.conf file with two different kernels is shown in Figure 12.2.
This particular grub.conf file makes it look as if you have a choice between three different operating systems:
Red Hat Linux (new kernel number)
Red Hat Linux (old kernel number)
DOS (typically, a version of Microsoft Windows)
Remember, the kernel is the core of the operating system. Thus, when you install a new kernel, you ve actually installed another version of Linux. Yet both kernels still use most of the same utilities, programs, and commands.
You may also note the default=1 command, which actually points to the second stanza as the default operating system. In other words, if you don t select a different operating system in 10 seconds ( timeout ), GRUB automatically boots your old Red Hat Linux kernel.
You can see the result in Figure 12.3, which shows the associated GRUB menu. Note that the second listing for Red Hat Linux, with the original kernel number, is highlighted.
Note | The default Red Hat Linux bootloader is GRUB. The Red Hat installation program saves a version of LILO in /etc/lilo.conf.anaconda . If you make a copy of this file in /etc/lilo.conf , the Red Hat kernel RPM will automatically upgrade LILO as well. |