Possible Duplicate:
Is there a way to remove/hide old kernel versions?

On my laptop I have limited space but install all new updates, including kernel updates. However, Ubuntu doesn't seem to uninstall old kernels after installing a new kernel update. I guess this happens with reason: since the new kernel might fail, and it would be nice if GRUB provided a way to select the old kernel to boot with. But do I really need the whole history?, I guess not!:

rc linux-image-2.6.32-21-generic
rc linux-image-2.6.32-24-generic
rc linux-image-2.6.32-25-generic
rc linux-image-2.6.35-22-generic
rc linux-image-2.6.35-23-generic
rc linux-image-2.6.35-24-generic
rc linux-image-2.6.35-25-generic
rc linux-image-2.6.35-27-generic
rc linux-image-2.6.35-28-generic
rc linux-image-2.6.35-30-generic
rc linux-image-2.6.38-10-generic
rc linux-image-2.6.38-11-generic
ii linux-image-2.6.38-12-generic
rc linux-image-2.6.38-8-generic
ii linux-image-3.0.0-12-generic
ii linux-image-3.0.0-13-generic
ii linux-image-3.0.0-14-generic
ii linux-image-3.0.0-15-generic
ii linux-image-3.0.0-16-generic
ii linux-image-generic

I thought apt-get autoremove should remove at least some of those images, but it doesn't. I will remove those now by hand, but isn't there a way to do this automatically and to keep, let's say, the last three images? Yes a shell script and a cron job! Any alternatives?

marked as duplicate by fossfreedom, Jorge Castro, RolandiXor, Panther, Bruno Pereira Feb 3 '12 at 0:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Yes you're maybe right, didn't found this before. However, since the question targets more on removing the Grub entries, which is not my primary issue here (although some answers care about removing) I might not get a proper answer. (The number one voted answer is about hiding grub kernel entries.) – math Feb 2 '12 at 10:42
  • Again it's more about Grub than about packages! – math Feb 2 '12 at 12:31
  • I voted to close this as IMO it is a duplicate question, but it would be nice to only save 3 kernel versions. Perhaps file a feature request on Launchpad. – Panther Feb 2 '12 at 22:08

You can use Ubuntu Tweak to remove old kernels in an easy way and to do many other useful things. Here is an article explaining some of its features.


Why aren't old linux-images removed when installing new kernel updates?

Why should they get removed? To the system, there's no reason to do so. They can happily co-exist and if you are experiencing boot problems with the new kernel, you'll be happy that the old one didn't get removed.

But do I really need the whole history?

I only keep the old kernel until I'm sure the new one works fine. Updates usually should improve things, so running old kernels isn't advisable.

  • 5
    As you said: The reason for removing old kernels are: 1. It is not advisable to run them (security risk) 2. They consume a lot space ~500MB in my case 3. They clutter Grub menu entries. – math Feb 2 '12 at 14:20

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