[CentOS] Eliminate old kernels

Wed Nov 9 14:38:48 UTC 2005
Aleksandar Milivojevic <alex at milivojevic.org>

Quoting Sean O Sullivan <seanos at seanos.net>:

> iagosineiro at yahoo.es wrote:
>> Is there any commad for eliminate old kernels from grub instead of 
>> edit manually grub.conf and eliminate the files from /boot?
>
> To see which kernels are installed:
> rpm -qa | grep kernel
>
> then remove via :
> yum remove kernel-2.6.9-11.EL

Ah...  Useless use of grep category ;-)

Much faster (esp. if on older hardware):

# rpm -q kernel kernel-smp kernel-hugemem kernel-devel
kernel-2.6.9-11.EL
kernel-2.6.9-22.EL
kernel-2.6.9-22.0.1.EL
package kernel-smp is not installed
package kernel-hugemem is not installed
package kernel-devel is not installed
# rpm -e kernel-2.6.9-11.EL kernel-2.6.9-22.EL

And you are done...  Basically, it is the same as removing any other 
package. The rpm command can accept as argument either just a package 
name (kernel) or
package name and version (kernel-2.6.9-11.EL).

If you type only "rpm -e kernel", you'll get error message telling you 
more than
one version of the package matches.  There's an option '--allmatches' 
to remove
all versions, but you do not want to use it in this case (you need at 
least one
version of kernel installed).


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.