The Upgrade

With a working boot floppy in hand, you are now ready to actually upgrade the kernel RPMs and related packages. You must be logged in as root to execute these commands.

Non-Kernel Packages

First, you should upgrade the non-kernel packages. On a Red Hat Linux 5.2 system, type the following command from within the directory containing the downloaded and verified RPM files:

rpm -Uvh mkinitrd*rpm SysVinit*rpm initscripts*rpm

Kernel Source Packages

NoteNote:
 

Unless you do development work, you do not need to install or upgrade these packages.

Next, you should upgrade the kernel-headers and kernel-source packages. These packages take up a lot of room, and unless you are a deep kernel hacker, you probably do not need multiple copies of the source code around.

# rpm -Uvh kernel-headers-2.0.36-1.i386.rpm kernel-source-2.0.36-1.i386.rpm
kernel-headers              ##################################################
kernel-source               ##################################################                  

If you receive errors when upgrading the kernel-headers file, it is probably due to the fact it couldn't find a directory to remove. This is not a real problem and can be ignored.

Kernels and Modules

Next, use RPM to install the new kernels. Note that these kernel packages are installed (-i) rather than upgraded (-U) as an added safety step. By not removing the old kernel and modules, you should be able to boot back into the old version if you need to.

# rpm -ivh kernel-2.0.36-1.i386.rpm kernel-ibcs-2.0.36-1.i386.rpm kernel-pcmcia-cs-2.0.36-1.i386.rpm 
kernel                      ##################################################
kernel-ibcs                 ##################################################
kernel-pcmcia-cs            ##################################################

You may find out that there are conflicts between the old and new kernel-pcmcia packages. To get around this error you can either force the install or upgrade the package.

NoteNote:
 

You can't use the old kernel with PCMCIA if you upgrade the package.

# rpm -ivh --force kernel-pcmcia-cs-2.0.36-1.i386.rpm 
kernel-pcmcia-cs            ##################################################

Initial RAM disk

The final steps of the upgrade are to make the initial RAM disk for your machine and change LILO to boot the new kernel. These steps will require you to edit the /etc/lilo.conf file.

The purpose of the initial RAM disk is to allow a modular kernel to have access to modules that it might need to boot from before the kernel has access to the device where the modules normally reside. Thus, you end up with a chicken and egg problem, where you need a driver to talk to the hardware where the driver resides on. This problem normally occurs on systems with SCSI controllers.

If you are confused about if you need to create an initrd file, look in /boot. If you do not see any files that start with initrd, you can safely skip the step to create the initrd file. Otherwise, you should create a new initrd for the newly installed kernel.

To make this RAM disk, you will first need to find out what the kernel in /boot is called and then use the mkinitrd command.

To find out what kernel to link against, list the /boot directory and note the various kernels installed there. The Red Hat Linux kernel RPM install should create a symbolic link from the file /boot/vmlinuz to the kernel that it installed.

# ls -l /boot/vmlinuz*
lrwxrwxrwx   1 root     root           16 Dec  2 18:31 /boot/vmlinuz -> vmlinuz-2.0.36-1
-rw-r--r--   1 root     root       454325 Oct 13 22:41 /boot/vmlinuz-2.0.36-0.7
-rw-r--r--   1 root     root       454349 Nov 17 13:11 /boot/vmlinuz-2.0.36-1

In the above example, the kernel is /boot/vmlinuz-2.0.36-1. The mkinitrd command needs this information to create the new initrd file.

# mkinitrd /boot/initrd-2.0.36.img 2.0.36-1
# ls -l /boot/initrd-2.0.36*
-rw-r--r--   1 root     root       210885 Nov 20 09:57 /boot/initrd-2.0.36-0.7.img
-rw-r--r--   1 root     root       212043 Dec  2 18:47 /boot/initrd-2.0.36.img

This command has successfully created a new initial RAM disk called /boot/initrd-2.0.36.img. At this point, you are ready to edit the /etc/lilo.conf file to tell LILO to be able to load the new kernel.

Setting up LILO

The last step before rebooting your machine should be changing LILO to find the new kernel images. This is fairly simple by adding an entry to /etc/lilo.conf that follows this example:

image=/boot/vmlinuz-<kernel version goes here>
      label=linux-test
      root=<your root (/) partition goes here>
      initrd=/boot/initrd-<kernel version goes here>
      read-only

On the example Red Hat Linux 5.2 system, the following changes were made to the /etc/lilo.conf file.

            
# cat /etc/lilo.conf 
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz-2.0.36-1
        label=linux
        root=/dev/hda9
        initrd=/boot/initrd-2.0.36.img
        read-only
image=/boot/vmlinuz-2.0.36-0.7
        label=linux.old
        root=/dev/hda9
        initrd=/boot/initrd-2.0.36-0.7.img
        read-only
other=/dev/hda1
        label=dos
        table=/dev/hda

With this configuration, the new kernel is the default kernel to use at boot. The original kernel entry has been retained with the label linux.old.

While the root partition for this 5.2 example system is /dev/hda9, your root partition will most likely be different. Be sure to note the partition information for your system, as it can be very useful when diagnosing a boot problem or using an emergency boot floppy to fix incorrect LILO information.

Finally, you must run the lilo command to write these changes to the boot sector LILO is installed on.

# lilo -v
LILO version 20, Copyright 1992-1997 Werner Almesberger

Reading boot sector from /dev/hda
Merging with /boot/boot.b
Boot image: /boot/vmlinuz-2.0.36-1
Mapping RAM disk /boot/initrd-2.0.36.img
Added linux *
Boot image: /boot/vmlinuz-2.0.36-0.7
Mapping RAM disk /boot/initrd-2.0.36-0.7.img
Added linux.old
Boot other: /dev/hda1, on /dev/hda, loader /boot/chain.b
Added dos
/boot/boot.0300 exists - no backup copy made.
Writing boot sector.

You should now be ready to reboot your machine with the shutdown -r now command. The system will start up with the new kernel. Remember to remove the rescue floppy from the drive before restarting your system.