Back Next Previous Contents

2. Before You Upgrade

Since upgrading your kernel can be tricky, you should probably only do so when you absolutely have to. Typical reasons for this include:

2.1 Finding What You Need

NOTE: Check to make sure that you have enough space for your kernel in /boot before you install the new kernel!

The usual steps on upgrading your kernel are to find out what you have installed already on your machine, and then compare it with what you need to have on your machine. You can find out what you have installed on the system with the rpm command. You need to make sure that you have the LATEST RPMs that are asked for from Red Hat or the upgrade will fail.

On a machine with Red Hat Linux 5.2 or 6.x installed, you would first want to find out what version of the kernel RPMs you have installed. Write down what versions you have installed.


   $ rpm -q kernel kernel-headers kernel-ibcs kernel-pcmcia-cs kernel-source

   kernel-2.0.36-0.7
   kernel-headers-2.0.36-0.7
   kernel-ibcs-2.0.36-0.7
   kernel-pcmcia-cs-2.0.36-0.7
   kernel-source-2.0.36-0.7

   $ rpm -q mkinitrd SysVinit initscripts

   mkinitrd-1.8-3
   SysVinit-2.74-5
   initscripts-3.78-1

            

If you have Red Hat Linux 4.2 on your machine, you will need to change the query slightly to reflect name changes in packages that occurred in the Red Hat Linux 5.x series of releases.


   $ rpm -q kernel kernel-headers kernel-source iBCS pcmcia-cs

   kernel-2.0.35-0
   kernel-headers-2.0.35-0
   kernel-modules-2.0.35-0
   kernel-source-2.0.35-0
   iBCS-2.0-8
   pcmcia-cs-2.9.12-0


   $ rpm -q mkinitrd SysVinit initscripts

   mkinitrd-1.7-1
   initscripts-2.96-1
   SysVinit-2.64-8

            

2.2 Getting the updates

The next step in this upgrade is to get the latest updates for your system. I normally use ftp://updates.redhat.com for this, but if you find it busy, you may want to try a mirror site.

Compare the list of RPMs you see on the FTP site with the ones you have installed on your machine. If the RPMs on the FTP site have larger revision numbers, download those RPMs. If the package is not listed, then you do not need to worry about it.

Since I find Web browsers to not be useful for multiple downloads, I usually recommend using an FTP client program to connect to the updates site. In Linux, I use ncftp.


  $ ncftp -L updates.redhat.com
  NcFTP 2.4.3 (March 19, 1998), by Mike Gleason.
  Tip: Use the "more" command to view a remote file with your pager.

  Trying to connect to ftp.redhat.com...
  ProFTPD 1.2.0pre1 Server (ProFTPD) [updates.redhat.com]
  Anonymous access granted, restrictions apply.
  ncftp /pub > cd redhat/updates/5.2/i386
  ncftp ...edhat/updates/5.2/i386 > ls kern* mkinit* iBCS* pcmcia* init* SysV*
    kernel-2.0.36-3.i386.rpm               kernel-pcmcia-cs-2.0.36-3.i386.rpm
    kernel-headers-2.0.36-3.i386.rpm       kernel-source-2.0.36-3.i386.rpm
    kernel-ibcs-2.0.36-3.i386.rpm
  ncftp ...edhat/updates/5.2/i386 > mget kernel-*rpm                            

            

If you have problems with the download, you may want to try the get -C versus the mget version. This will cause ncftp to keep trying to download the RPMs until you have a complete version.

2.3 Important for Red Hat Linux 4.x users:

If you have not gotten any updates from the FTP site for your system before, you will most likely need to upgrade the rpm package before you will be able to confirm or install the new RPMs.

The methodology for this upgrade is pretty simple. Check what version of RPM you have installed. Compare that version number against any updates on the FTP site. If the FTP site has a later version, you will need to download it and upgrade the package. Or in a nutshell:


              $ rpm -q rpm rpm-devel
              rpm-2.5.5-5.2
              rpm-devel-2.5.5-5.2
              $ ncftp updates.redhat.com
              > cd 5.2/i386
              > get rpm*
              > quit
              $ rpm -Uvh rpm*rpm

            

If the versions are very very different (upgrading 2.3 to 2.5 or something like that) I recommend that you also do the following after the upgrade.

              $ rpm --rebuilddb
            

This last step should fix any "problems" between database layouts of the different versions (or in case one of the databases had become corrupt.) It will usually take a while to complete this rewrite as it is doing a very low level RPM task.

2.4 Confirming the RPMs

One of the most annoying things to occur is if you download an RPM package and it was corrupted sometime during the download. In the case of a kernel upgrade, this problem is more than annoying as you could find yourself with an unbootable machine.

In order to make a system administrator's life easier, RPM has ways to check that the RPM meets self consistency. To do this, we use the -K --nopgp options. On the example Red Hat Linux 5.2 system, we downloaded the packages and got the following response from RPM.


   $ rpm -K --nopgp *rpm
   kernel-2.0.36-1.i386.rpm: size md5 OK
   kernel-headers-2.0.36-1.i386.rpm: size md5 OK
   kernel-ibcs-2.0.36-1.i386.rpm: size md5 OK
   kernel-pcmcia-cs-2.0.36-1.i386.rpm: size md5 OK
   kernel-source-2.0.36-1.i386.rpm: size md5 OK

            

If all the RPMs have correct md5sums, then you should be able to continue on. If not, try downloading again. In my experience, if you are getting repeated failures to try a different mirror, as the problem may be with the network connection to that site or some sort of transparent caching device that is keeping the "bad" copy resident.

2.5 Making an emergency boot floppy

The final pre-install step is to make an emergency boot floppy (if you haven't made one already.) On Red Hat Linux 5.x and 6.x machines you can simply do this with the mkbootdisk command.

First find out what kernel you are currently using. Check out your /etc/lilo.conf file and see which image was booted from. On my example machine, I have the following in the file.


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

            

Now you will need to find the image that you booted from. On a standard installation, it will be the one labeled linux. The above example shows that the machine booted using the /boot/vmlinuz-2.0.36-0.7 kernel. Now simply put a formatted 1.44 floppy in your system, and make sure you have logged in as root.


  # whoami
  root
  # mkbootdisk --device /dev/fd0 2.0.36-0.7
  Insert a disk in /dev/fd0. Any information on the disk will be lost.
  Press <Enter> to continue or ^C to abort: 

            
Following these guidelines, you will now have a boot floppy with a known working kernel in case of problems with the upgrade. I recommend rebooting the system with the floppy to make sure that the floppy works correctly.
Back Next Previous Contents