Remove old kernels in Debian / Ubuntu (System and GRUB)

When the Linux kernel is updated, older versions of the same does not uninstall the system and are stored on your computer , serving as a backup boot that if we have installed new kernel fails or is badly compiled. However, over time , and increasingly updates , is annoying to have saved several versions of the kernel, moreover, that if you use GRUB to select the operating system to boot, this also reflects all the kernels that we have in the system.

For the above reasons (and if you do not need an old kernel in our system ) , it is feasible remove older Linux kernels, So that they can no longer boot. Similarly we can remove the GRUB kernels out of the way when turning on the computer .

For delete old kernels System and GRUB, just enough three easy steps:

1. kernel is verified that we are using , with that which we know is that we must make in the distro installed . To do this we write in the terminal the command:

$ uname -r


2. We look for the kernels you have installed , to identify those who are no longer useful . We did it with the command:



$ Dpkg - get -selections | grep linux -image


This will return a list containing all available in the system kernels. Example:



linux -image -2.6 -686 install
linux -image- 2.6.26- install 1-686
linux -image- 2.6.26- install 2-686


Here we see that the surplus is 2.6.26-1-686 kernel , so it is that we should delete. If you have a greater number of kernels available. The list will be longer.



3. We now proceed to delete the remaining kernels, taking care not to delete the one we are using ( and already identified ). We use a command like this , substituting the name of the kernel as applicable :



$ Apt -get remove- purge linux -image- 2.6.26- 1-686


Where you replace "linux -image- 2.6.26- 1-686" For the kernel you want to delete . Repeat this as many times as you need (and have unused kernels )



P.S. Remember to do all this with the user Root Or by using sudo. I hope this tutorial is to help small tarball