Next Previous Contents

3. The Upgrade

We should now be ready to actually upgrade the kernel rpm's and related packages. You will need to be logged in as root to execute all of these commands.

3.1 Non Kernel Packages

First, I will upgrade the non-kernel packages. On a 5.2 system, you would type something similar to


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

            

3.2 Kernel Source Packages

Note: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 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 recieve errors when upgrading the kernel-headers file it is due to the fact it couldn't find a directory to remove but everything else should work ok.

3.3 Kernel and Modules

The final task to do with RPM is to install the new kernels. We do an install instead of an upgrade 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. Again on my example 5.2 machine,


# 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 (Note: 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            ##################################################

            

3.4 Initial Ramdisk

The final steps of the upgrade are to make the initial ram disk for your machine, and to manipulate 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.

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

To find out what the kernel we need to link against, we will list the /boot directory, and look for what kernels are installed. The Red Hat 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 and we can feed this data to the mkinitrd command.

# 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

            

We have successfully created the initial ram disk called /boot/initrd-2.0.36.img, and can proceed to editing the LILO files.

3.5 Setting up LILO

The last step before rebooting your machine should be editing LILO to find the new kernel images. This is fairly simple by adding an entry that follows this template:

  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 my example 5.2 machine, I made the following changes 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

            

What this did was make the "default" boot kernel the new one I installed, and I renamed the option for booting the old kernel to be linux.old. On my system the root partition is /dev/hda9 but this will most likely different on your machine.

Finally, you will need to 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 be ready to reboot your machine with shutdown -r now and the system will come up with the new kernel. Remember to remove the rescue floppy from the drive (which is what I forgot to do when writing this article).


Next Previous Contents