| Upgrading the Linux Kernel on Red Hat Linux systems | ||
|---|---|---|
| Prev | ||
This appendix deals directly with upgrading a box installed with a stock Red Hat Linux Intel 6.2 release to the kernel errata released on 8 February 2001.
First, download the appropriate files indicated by the errata: http://www.redhat.com/support/errata/RHSA-2001-013.html
For this example, it is assumed that the kernel version to be used will be 2.2.17-14smp and that SCSI exists on the system (therefore requiring the use of an initrd file).
Save the update kernel RPM files necessary to complete the update to a temporary directory. One good place to store these RPMs is in the /usr/local directory within a special directory that only holds the updated packages.
Assuming that the /usr/local/70errata directory is used to hold the files, a listing of this directory should reveal the downloaded RPMs:
kernel-2.2.17-14.i686.rpm kernel-doc-2.2.17-14.i386.rpm kernel-ibcs-2.2.17-14.i386.rpm kernel-smp-2.2.17-14.i686.rpm kernel-source-2.2.17-14.i386.rpm kernel-utils-2.2.17-14.i386.rpm |
In addition, check to see if any new mkinitrd, SysVinit, or initscripts packages are available. If so, download them as well.
For example, at this time of writing, if you are running Red Hat Linux 6.2, you should also download the SysVinit-2.78-5.i386.rpm update to your /usr/local/70errata directory.
To verify that each of the files was successfully downloaded, change to the directory containing the RPM files and run the following command:
# rpm -K --nogpg *rpm |
Each file should report back md5 OK. If any report any errors, you should delete that file and download it again.
Also, if you do not already have a boot disk, now would be a good time to create one. List your /boot directory and note the current vmlinuz link. It should look something like this:
lrwxrwxrwx 1 root root 20 Apr 2 16:27 vmlinuz -> vmlinuz-2.2.16-22 |
Use this kernel version to create the boot disk:
# mkbootdisk --device /dev/fd0 2.2.16-22 Insert a disk in /dev/fd0. Any information on the disk will be lost. Press |
Now, with a boot disk available in case of error, you can safely begin to install the new kernel.
6.2 users should upgrade SysVinit the package first before installing the kernel packages:
# rpm -Uvh SysVinit-2.78-5.i386.rpm |
Next, install the main kernel RPM packages. Remember, when doing a kernel upgrade, always install files. Do not update them using RPM, as you may want to have the option to boot from the older kernel after the installation of the newer kernel.
# rpm --force -ivh kernel-2.2.17-14.i686.rpm kernel-smp-2.2.17-14.i686.rpm |
Then, upgrade the other non-kernel errata, if desired.
# rpm -Uvh kernel-doc-2.2.17-14.i386.rpm kernel-ibcs-2.2.17-14.i386.rpm \ > kernel-source-2.2.17-14.i386.rpm kernel-utils-2.2.17-14.i386.rpm |
If your system requires the use of PCMCIA, be sure to also download and install the kernel-pcmcia-cs-2.2.17-14.i386.rpm update.
Then check the files in /boot. A Red Hat Linux 7.0 system will look something like this:
# ls -l /boot lrwxrwxrwx 1 root root 23 Apr 2 16:27 System.map -> System.map-2.2.17-14smp -rw-r--r-- 1 root root 200285 Aug 22 2000 System.map-2.2.16-22 -rw-r--r-- 1 root root 212399 Feb 5 15:05 System.map-2.2.17-14 -rw-r--r-- 1 root root 191388 Feb 5 14:48 System.map-2.2.17-14BOOT -rw-r--r-- 1 root root 225153 Feb 5 14:43 System.map-2.2.17-14smp -rw-r--r-- 1 root root 512 Apr 2 11:30 boot.1600 -rw-r--r-- 1 root root 5824 Aug 23 2000 boot.b -rw-r--r-- 1 root root 612 Aug 23 2000 chain.b -rw-r--r-- 1 root root 390222 Apr 2 16:23 initrd-2.2.16-22.img -rw-r--r-- 1 root root 390427 Apr 2 16:21 initrd-2.2.16-22smp.img lrwxrwxrwx 1 root root 15 Apr 2 16:31 kernel.h -> kernel.h-2.2.17 -rw-r--r-- 1 root root 0 Feb 5 15:09 kernel.h-2.2.17 -rw-r--r-- 1 root root 405 Apr 2 15:44 kernel.h-2.4.0 drwxr-xr-x 2 root root 12288 Apr 2 11:21 lost+found -rw------- 1 root root 10752 Apr 2 11:30 map -rw-r--r-- 1 root root 23108 Aug 23 2000 message lrwxrwxrwx 1 root root 24 Apr 2 16:27 module-info -> module-info-2.2.17-14smp -rw-r--r-- 1 root root 11773 Aug 22 2000 module-info-2.2.16-22 -rw-r--r-- 1 root root 11773 Feb 5 15:05 module-info-2.2.17-14 -rw-r--r-- 1 root root 11773 Feb 5 14:43 module-info-2.2.17-14smp -rw-r--r-- 1 root root 640 Aug 23 2000 os2_d.b -rwxr-xr-x 1 root root 1621492 Aug 22 2000 vmlinux-2.2.16-22 -rwxr-xr-x 1 root root 1729084 Feb 5 15:05 vmlinux-2.2.17-14 -rwxr-xr-x 1 root root 1570927 Feb 5 14:48 vmlinux-2.2.17-14BOOT -rwxr-xr-x 1 root root 1846682 Feb 5 14:43 vmlinux-2.2.17-14smp lrwxrwxrwx 1 root root 20 Apr 2 16:27 vmlinuz -> vmlinuz-2.2.17-14smp -rw-r--r-- 1 root root 627392 Aug 22 2000 vmlinuz-2.2.16-22 -rw-r--r-- 1 root root 663335 Feb 5 15:05 vmlinuz-2.2.17-14 -rw-r--r-- 1 root root 604752 Feb 5 14:48 vmlinuz-2.2.17-14BOOT -rw-r--r-- 1 root root 691136 Feb 5 14:43 vmlinuz-2.2.17-14smp |
System.map, module-info, and vmlinuz should be pointing at the appropriate file for your kernel, in this case the ones for 2.2.17-14smp. You can use the ln -s -f <existing file> <link name> command to redirect the links if needed.
# cd /boot # ln -s -f System.map-2.2.17-14smp System.map |
Now to create a initrd file. If you don't have a SCSI system then you probably can skip this step. If you are not sure, check the /boot directory. If you have a file that starts with initrd, you will need a new one.
The mkinitrd command takes arguments in the format:
mkinitrd </path/to/file/to/create> <kernel-version-to-create> |
Since you will want an initrd to use with both the SMP kernel and the uniprocessor kernel (the latter for use in the case of emergencies or debugging), the mkinitrd command will need to be run twice, slightly differently:
mkinitrd /boot/initrd-2.2.17-14smp.img 2.2.17-14smp mkinitrd /boot/initrd-2.2.17-14 2.2.17-14 |
Most errors seen when creating the initrd RAM disk files are usually caused by typos, such as specifying the wrong kernel to use when creating each file. It may also be possible that the loop kernel module was not loaded. In the latter case, use:
modprobe loop |
and run the mkinitrd commands again.
The last and, possibly, most important step in updating your Linux kernel involves editing /etc/lilo.conf to boot using the new kernel.
Your /etc/lilo.conf file should look similar to this:
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 message=/boot/message linear default=linux image=/boot/vmlinuz-2.2.16-22 label=linux initrd=/boot/initrd-2.2.16-22.img read-only root=/dev/hda5 image=/boot/vmlinuz-2.2.16-22smp label=linux-smp initrd=/boot/initrd-2.2.16-22smp.img read-only root=/dev/hda5 |
Pay particular attention to the root= line. This value specifies the boot partition. Most people will have /dev/hda# (for IDE hard drives) or /dev/sda# (for SCSI hard drives). Other values are possible, however, such as /dev/ida/c0d0p5, which specifies a Compaq Smart Array Raid controller in this particular system.
To make the change for our example lilo.conf file, simply copy the original two image stanzas and edit the version numbers to match the new kernel and initrd file versions in /boot. Then, be sure to modify the label= lines for each of the image sections so that they are unique and descriptive. Finally, change the default= line to point to the kernel you would like to boot automatically.
The modified /etc/lilo.conf file should look similar to this:
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 message=/boot/message linear default=linux-smp image=/boot/vmlinuz-2.2.17-14 label=linux initrd=/boot/initrd-2.2.17-14.img read-only root=/dev/hda5 image=/boot/vmlinuz-2.2.17-14smp label=linux-smp initrd=/boot/initrd-2.2.17-14smp.img read-only root=/dev/hda5 image=/boot/vmlinuz-2.2.16-22 label=linux-2.2.16 initrd=/boot/initrd-2.2.16-22.img read-only root=/dev/hda5 image=/boot/vmlinuz-2.2.16-22smp label=linux-2.2.16smp initrd=/boot/initrd-2.2.16-22smp.img read-only root=/dev/hda5 |
Note that merely placing this new information in /etc/lilo.conf does not cause it to be used by LILO when the system is restarted. To activate the modified LILO configuration, run the following command:
/sbin/lilo -v |
This will write the changed /etc/lilo.conf configuration to the Master Boot Record (MBR). The output may look like the following:
# /sbin/lilo -v LILO version 21.4-4, Copyright (C) 1992-1998 Werner Almesberger 'lba32' extensions Copyright (C) 1999,2000 John Coffman Reading boot sector from /dev/hda Merging with /boot/boot.b Mapping message file /boot/message Boot image: /boot/vmlinuz-2.2.17-14 Added linux Boot image: /boot/vmlinuz-2.2.17-14smp Added linux-smp * Boot image: /boot/vmlinuz-2.2.16-22 Added linux-2.2.16 Boot image: /boot/vmlinuz-2.2.16-22smp Added linux-2.2.16smp /boot/boot.1600 exists - no backup copy made. Writing boot sector. |
Now, with your boot disk out of the drive (you did make a boot disk, right?) you should reboot and try out the new kernel. It should automatically load without intervention.