Sunday, July 13, 2008

Remove Old Kernels In Ubuntu

I was asked to do a tutorial on how to remove older kernels from your system to save space.
I'm going to do it but before I go any further I have to post this;

Disclaimer and Warning!!!!
I will not be responsible for any damages incurred to your system by following this tutorial.
It is YOUR responsibility to carefully read and follow the instructions in this tutorial. It is also your responsibility to make intelligent decisions when deciding what kernels you will remove. Removing the wrong kernel version will render your system inoperable.

There! That legal nonsense is done.

The first thing you need to do is find out what kernel version you are using at the moment.
So open up your terminal and type in the following command;
uname -r

You will get a result that looks like this;
2.6.22-15-generic

You can see that I am running version 2.6.22-15-generic

Write that down. Don't depend on your cranium memory because depending on how many versions you have installed, you can become easily confused on what version you are using and may end up deleting the wrong version.

Close your terminal and open up your Synaptic package manager.
Click on Search and type in Linux-Image
Your results will show you all the versions available and the versions you have installed will have a green box in front of those.

Carefully scroll all the way to the end as they are not all grouped together.

Now find your version and make note where it is in the list.
Look through the list for the kernel that is one version previous to the one you have installed now.
You also want to keep that previous version in case something goes wrong with your current version like during an update. That way you can boot into the previous version and try to get things fixed.

Now make note of the remaining versions. Careful! Don't mistake a version like 2.6.22-15.52 as an older version of 2.6.22-14.54

Once you have identified any other older versions in your list you can mark them for removal.
I do want to make a notation here about the packages in the list.
You will see at least one file that looks like the following;
Linux-Image-Generic and to the right under the Installed Version column you will see something like 2.6.22.15.22
If you highlight it, right click and check the Properties you will see it is about 56k in size.
Do NOT delete that file!
It is the header used by the 2.6.22.15 kernel.
Deleting that will damage your system.

Once you are finished removing your old kernels it may be a good idea to reboot the system and make sure everything is working correctly.

Good luck and hopefully you had no problems during the removal of your old kernels.
I fulfilled a request and hope it helps many others.

TaZMAn

4 comments:

Anonymous said...

It looks like everyone has deleted the wrong ones

Anonymous said...

You can do it via the command line check this post

TaZMAn said...

Thanks for that helpful link.
That is what make Linux so great. Users helping users build a better community.

Anonymous said...

Thanks!!! It worked