Sunday, December 6, 2009

Removing older kernels

Warning

Don’t follow this process unless you’re sure you don’t need to boot into the older kernels. If you’re not sure, just leave things alone. Also, it is possible to remove all of the kernels from your system and make it unbootable. I suggest leaving the latest kernel and one version previous to that. You can find out the kernel version that you’re currently running with

uname -r

Find and remove old kernels

The first step is to figure out what kernels are installed. The following command will do the job.

ls /boot | grep vmlinuz | cut -d'-' -f2,3

Your result could look something like this (running Hardy).
2.6.24-19
2.6.24-19
2.6.24-21
2.6.24-22
2.6.24-23
2.6.24-24
2.6.24-25
2.6.24-26


his is the list of kernels installed on your system. Now you want to find out which packages are installed relative to the kernel you want to remove. For my example I’m going to remove the oldest one 2.6.24-19

On my system, (JHardy) the resulting list is:

linux-headers-2.6.24-19
linux-headers-2.6.24-19-generic
linux-image-2.6.24-19-386
linux-image-2.6.24-19-generic
linux-ubuntu-modules-2.6.24-19-generic

Now that we know what packages to remove we can remove them with dpkg, apt-get or aptitude.
sudo aptitude remove linux-headers-2.6.24-19 linux-headers-2.6.24-19-generic linux-image-2.6.24-19-386 linux-image-2.6.24-19-generic linux-ubuntu-modules-2.6.24-19-generic

source:
http://tuxtweaks.com/2009/12/remove-old-kernels-in-ubuntu/

No comments:

Blog Archive