How can I remove old linux-images when installing new kernel updates?

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?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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.

Solution 2

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.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply