Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

How to remove kernel packages with yum in FC3

by Thomas Chung on Nov 17, 2004

Suppose you want to remove a specific version of kernel package because it's causing a kernel panic.
Here is how you can remove them with yum in FC3:

[tchung@tchung-fc3 ~]$ rpm -qa | grep kernel
kernel-smp-2.6.9-1.678_FC3
kernel-smp-2.6.9-1.667
kernel-2.6.9-1.667
kernel-utils-2.4-13.1.39
kernel-2.6.9-1.678_FC3
[tchung@tchung-fc3 ~]$ rpm -qa | grep kernel | grep 678
kernel-smp-2.6.9-1.678_FC3
kernel-2.6.9-1.678_FC3
[tchung@tchung-fc3 ~]$ sudo yum remove kernel-smp-2.6.9-1.678_FC3 kernel-2.6.9-1.678_FC3
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package kernel-smp.i686 0:2.6.9-1.678_FC3 set to be erased
---> Package kernel.i686 0:2.6.9-1.678_FC3 set to be erased
--> Running transaction check
 
Dependencies Resolved
Transaction Listing:
  Remove: kernel.i686 0:2.6.9-1.678_FC3
  Remove: kernel-smp.i686 0:2.6.9-1.678_FC3
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing: kernel 1/2
Erasing: kernel-smp 2/2
 
Removed: kernel.i686 0:2.6.9-1.678_FC3 kernel-smp.i686 0:2.6.9-1.678_FC3
Complete!
[tchung@tchung-fc3 ~]$

Now make sure your grub.conf is correct before the reboot.
Notice, the stanza for kernel version you've just removed is not there any more in /etc/grub.conf

[tchung@tchung-fc3 ~]$ sudo vi /etc/grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.9-1.667smp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-1.667smp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.9-1.667smp.img
title Fedora Core-up (2.6.9-1.667)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.9-1.667.img

BTW, if you want to exclude kernel packages from installing with yum, add following red line in /etc/yum.conf:

[tchung@tchung-fc3 ~]$ sudo vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
exclude=kernel*