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
What I do is:
Delete or Move the Kernel versions you do not want from
For abi files I have:
For config files I have:
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
Same goes for the rest, you should have several versions of abi, config, initrd.img, System.map, vmcoreinfo and vmlinuz. Delete/Move all but the last 2.
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
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:
You then can use
Another GUI way is Ubuntu Tweak (Mentioned by TomTasche) which offers an easy way to remove the old kernels:
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: