Fedora Installation

Deleting Unwanted Kernels

Sometimes when using Yum to update the Fedora installation there may be an "out of space" message such as...

Transaction Check Error: installing package kernel-xxxxxxx needs 4MB on the /boot filesystem

even though the drive has plenty to spare. What happens is that the boot directory where the kernels are installed is of fixed size, usually around 100Mb.

Another message you might see is something like...

Error: unpacking of archive failed on file /boot/system.map-xxxxxxxx; xxxxxx: cpio: write

Contents of the boot directory

Contents of the boot directory

The boot directory contains files with named config-xxxxxx, intridxxxxxx.img, System.map-xxxxxx and vmlinuxxxxxx where xxxxxx are the installed kernels which should correspond with the kernels found in Desktop > System Settings > Bootloader list.

Bootloader list

Bootloader list

DO NOT simply delete the files from the boot directory. The best way to delete these files, which incidentally also updates the bootloader list which is held in boot/grub/grub.conf, is to use rpm.

Listing installed kernels

To list the kernels installed on the computer, in Terminal type...

rpm -qa kernel


Do not delete all the kernels. You must have at least one working for the computer to boot properly.

Do not manually delete files from the boot directory. A good example of why you shouldn't do this occurred in September 2005. kudzu, the Fedora hardware detection program wouldn't update. It complained that it couldn't operate with a kernel version less than 2.6.13 still on the system. Deleting the kernels by hand from the /boot directory does not clean the system enough and traces of these files are still left, probably in the system files, and these had to be removed using the methods on these pages before kudzu could be updated.

Be careful when using wildcards when deleting the unwanted kernels. It's very easy to delete something you don't mean to.

When deleting multiple files using wildcards and rpm you must use the --allmatches switch.

Deleting installed kernels

To delete these unwanted kernels, in Terminal type...

rpm -e kernel-xxxxxx

where xxxxxx is the kernel number as listed in terminal using the rpm -qa kernel command.

DO NOT erase all of them.

You can use wildcards, such as...

rpm -e --allmatches kernel-2.6.12-1.144*

Be very careful if you do this, it is very easy to delete files you don't mean to by using wildcards. Also, if you do not use the --allmatches switch you will see the following error message...

error: "kernel-xxxxxx*" specifies multiple packages

The cleaned bootloader

The cleaned bootloader


After some installations you may see a line when running yum update that says Loading "installonlyn" plugin what is happening is that yum is loading a plugin that will limit the number of kernels that are installed. The plugin being installed is at usr/lib/yum-plugins/installonlyn.py

The configuration file for this plugin is at etc/yum/pluginconf.d/installonlyn.conf

Due to the nature of the FC5 experimental kernels I found it's a good idea to edit this file. The original file looks like this...

# this sets the number of package versions which are kept

To disable the plugin change the line enabled=1 to enabled=0>

To increase the number of kerenels kept change the line tokeep=2. I've changed mine to tokeep=10. This should keep enough kernels to keep me happy without filling the /boot partition.

Some anomalies during file listing

Whilst preparing this article I found some odd behaviour whilst creating the file listings. All my kernel files currently installed start with kernel-2xxxxxx

rpm -qa kernel


rpm -qa | grep kernel-2

gives a listing of just the kernel files, such as kernel-2.6.12-1.1435_FC5 and kernel-2.6.12-1.1433_FC5

rpm -qa kernel*


rpm -qa | grep kernel


rpm -qa | grep kernel*


rpm -qa | grep kernel-2*

gives the above files plus files such as kernel-devel-xxxxxx and kernel-smp-devel-xxxxxx. Once the kernels have been removed then these associated files can also be removed.

but neither

rpm -qa kernel-2


rpm -qa kernel-2*

return anything.

This page created 13th August 2005, last modified 17th November 2005

GoStats stats counter