Remove old linux kernels

Posted: January 12, 2013 in System Administration
Tags: ,

When upgrading linux kernel, Ubuntu does not automatically remove previous version of the kernel. Yup, it is good if you keep the previous version, so that if anything crashes (eg: your driver is incompatible with the new kernel), you may revert to the old kernel. However, sometimes the old kernels may accumulate and fill up your disk space. Therefore, if you are running fine on your current kernel, you can choose to remove the old ones to free up some disk space. Here’s how you can do it.

  1. Launch your preferred package or software manager. The new Ubuntu ships with Ubuntu Software Center, so you may use that.
  2. Under installed software, search for linux-image.
  3. Remove all kernels other than your current version. (You may find out your kernel version by executing “uname -r” on the terminal.) Using the screenshot below as example, the current kernel version is 3.2.0-35-generic-pae. So we will remove other kernels, which are 3.2.0-23-generic-pae, 3.2.0-24-generic-pae, and 3.2.0-29-generic-pae. The package ‘Generic Linux kernel image’ needs not be removed because it is just a meta-package to pull in the latest kernel image.
  4. Ubuntu Software CenterThen, under installed software, search for linux-headers.
  5. Do the same as step 3. Remove previous version of the linux headers.
  6. Remove GRUB entries for older kernels.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s