Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have many kernels in the boot menu. I want some of them, but rest should be removed/uninstalled. How can I select and keep the kernels I want and remove rest of them? I should be able to remove the kernel headers as well

share|improve this question
up vote 4 down vote accepted

What I do is:

Delete or Move the Kernel versions you do not want from /boot to another place. For example in my case I have:

For abi files I have: abi-3.0.0-12, abi-3.0.0-13, abi-3.0.0-14, abi-3.0.0-15

For config files I have: config-3.0.0-13, config-3.0.0-14, config-3.0.0-15

For the rest I also have the same thing. About 4 or 5 versions of it. So I literally delete (or more recommended it is to move) the files to another place and leave the last version and the previous version for that. For example, for the abi files I would leave the last ones which are abi-3.0.0-14 and abi-3.0.0-15

Same goes for the rest, you should have several versions of abi, config, initrd.img,, vmcoreinfo and vmlinuz. Delete/Move all but the last 2.

then execute sudo update-grub and reboot. You should now have only the last 2 shown in the list.

NOTE - It is more recommended to Move the files instead of deleting in case you have a problem later.

UPDATE: As suggested by Lekensteyn using dpkg -S /boot/filename will show you what package is responsible for the filename in boot. For example: dpkg -S /boot/abi-3.0.0-12-generic will show you:

linux-image-3.0.0-12-generic: /boot/abi-3.0.0-12-generic

which means that the package linux-image-3.0.0-12-generic is responsible for installing that specific file. If you want to see the whole linux-image files do something like:

sudo apt-cache search linux-image or more friendly sudo aptitude search linux-image

You then can use sudo apt-get remove PACKAGE for each one but of course will take some time since there are several. A quick GUI way is Synaptic since you can select multiple packages and then just mark them for deletion.

Another GUI way is Ubuntu Tweak (Mentioned by TomTasche) which offers an easy way to remove the old kernels:

enter image description here

I should mention that when I started deleting kernel files Ubuntu-Tweak did not exist. After using it and booting again without any problem I can say that you can use it and not be afraid of some problem since it removes the packages the same way as purging/removing them with aptitude or apt-get. What I still recommend is leaving the previous version of the kernel, so if you have 3.0.0-15 as the latest, keep also 3.0.0-14 just in case something happens with 15 you can have a backup by going to 14.

To install ubuntu-tweak:

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak
share|improve this answer
Why move that files and not remove corresponding packages, instead? – enzotib Dec 14 '11 at 8:10
It's not recommended to remove files in that way. Use dpkg -S /boot/filename to find out which package provides the file. – Lekensteyn Dec 14 '11 at 11:43
Yes I mention it above but let me be more clear with it. – Luis Alvarado Dec 14 '11 at 13:30

That's possible using Ubuntu Tweak.

share|improve this answer
Could you provide some directions on how to install it? That would make your answer more helpful to others later on. – John S Gruber Aug 14 '12 at 3:02
The question was about uninstalling kernels, but installing one is as easy as installing a .deb... You just have to find one. – TomTasche Aug 14 '12 at 7:07
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – hexafraction Aug 18 '12 at 16:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.