Since upgrading your kernel can be tricky, you should probably only do so when you absolutely have to. Typical Reasons for this are usually:
NOTE: Check to make sure that you have enough space for your kernel
in /boot before you upgrade!
The usual steps on upgrading your kernel are to find out what you
have installed already on your machine, and then comparing 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 5.2 installed, you would first want to find out what version of the kernel RPM's 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 4.2 on your machine, you will need to change the query slightly to reflect name changes in packages that occured in the 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
The next step in my 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 RPM's you see on the ftp site with the ones you have installed on your machine. If the RPM's 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 updates.redhat.com...
ProFTPD 1.2.0pre1 Server (ProFTPD) [updates.redhat.com]
Anonymous access granted, restrictions apply.
updates2:/> cd 5.2/i386
updates2:/5.2/i386> ls
kernel-2.0.36-1.i386.rpm
kernel-headers-2.0.36-1.i386.rpm
kernel-ibcs-2.0.36-1.i386.rpm
kernel-pcmcia-cs-2.0.36-1.i386.rpm
kernel-source-2.0.36-1.i386.rpm
libc-5.3.12-28.i386.rpm
ls-lR
ls-lR.gz
samba-1.9.18p10-5.i386.rpm
svgalib-1.3.0-3.i386.rpm
svgalib-devel-1.3.0-3.i386.rpm
sysklogd-1.3-26.i386.rpm
zgv-3.0-6.i386.rpm
updates2:/5.2/i386> mget kernel-*rpm
If you have problems with the download, you may want to use
the get -C
versus the mget
version. This
will cause ncftp
to keep trying to download the
rpms until you have a complete version.
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 database's had become corrupt.) It will usually take a while to complete this rewrite as it is doing a very low level RPM task.
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 my 5.2 system, we
downloaded the packages and got the following responce 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 rpm's 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.
The final pre-install step is to make an emergency boot floppy (if
you havent made one already.) On 5.x and 6.0 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 5.2 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 install, 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.