How to uninstall the old kernels in ubuntu
Everytime there is an update for the kernel, the new kernel is installed while the old one is not automaticaly uninstalled, after several kernel updates, you will find a large list of old kernels in the start grub menu . So if we got no problem with the new installed kernel, we can just delete the old ones.
Today i will show you how to uninstall the old kernels, it is important to keep at least one old kernel, so in case if you have any problem with the new one, you can then switch to the old kernel.
First use this command to see the list of the installed kernels in your Ubuntu :
$ dpkg --get-selections | grep linux-image
In my case :
Now for example try to delete the oldest one (change oldest kernel with your oldest one) :
$ sudo apt-get purge oldest-kernel
In my case :
$ sudo apt-get purge linux-image-2.6.31-14-generic
If the kernel you try to uninstall is not updated, you will got a message to update first before to continue. update then the kernel and then uninstall that old kernel and the updates using the same command above.
Important : Do not uninstall the linux-image-generic as it is necessary to receive updates of the kernel.
Thanks to guia ubuntu for this tip ( In spanish)