Removing old kernels from your system

2008/06/05 by Paulo Pereira

~/categories/Linux #Linux #Ubuntu

After a while you’re starting to collect kernel versions on your system.

Since Hardy came out, with kernel 2.6.24-16, we had two kernel updates, so, in grub we have now entries to kernels 2.6.24-16, 2.6.24-17 and 2.6.24-18.

We just need one to boot in, and we and the most recent one of course. Still, when deciding to remove an old kernel be aware of possible problems.

Virtualbox for instance, needs a module to the specific kernel you’re running. Every time a new kernel is released your Virtualbox setup will not work until your upgrade the said module. So, if you need to use Virtualbox and you don’t yet have the new module, you could just restart into the old kernel.

So, think before you remove old kernels.

Removing old kernels

sudo dpkg --list | grep linux-image
ii  linux-image-2.6.24-16-generic                  2.6.24-16.30                                       Linux kernel image for version 2.6.24 on  x86
ii  linux-image-2.6.24-17-generic                  2.6.24-17.31                                       Linux kernel image for version  2.6.24 on x86
ii  linux-image-2.6.24-18-generic                   2.6.24-18.32                                       Linux kernel image  for version 2.6.24 on x86
ii  linux-image-generic                            2.6.24.18.20                                       Generic  Linux kernel image
ii   virtualbox-ose-guest-modules-2.6.24-18-generic 24.0.3                                             virtualbox-ose-guest module for linux-image-
ii  virtualbox-ose-modules-2.6.24-18-generic       24.0.3                                             virtualbox-ose module for  linux-image-2.6.24
uname -r
sudo apt-get remove linux-image-2.6.24-16-generic
sudo update-grub

And that is that.