Falcon1986-Online

Home of a med student who likes to manage websites and talk tech!

[HOW-TO] Remove old kernels from Ubuntu

leave a comment »

Ubuntu LogoThe Linux kernel is not updated very often to require removing old versions regularly. However, when a new version is released, sometimes you may want to remove the old version so as to save on the disk space used. I normally employ the following method when removing old kernels because it is quite thorough and can be mostly accomplished through a terminal window. If you are accustomed to going through the Synaptic Package Manager and manually marking old versions for removal, you may want to try this alternative. However, before you start cleaning, you need to be aware of the all kernel versions that are currently installed on Ubuntu. The last thing you want to do is remove something unintentionally and be faced with an unbootable system.

  1. Go to System > Administration > Synaptic Package Manager and perform a search for linux-image. From the search results identify those installed items with linux-image-2.6.xx-xx-* in the file name. The screenshot shows three kernel versions currently installed: 2.6.28-11, 2.6.28-13 and 2.6.28-14. Take note of these.
    Synaptic Package Manager

    Synaptic Package Manager

  2. Launch the terminal and run the following command to verify the currently-installed kernel version.
    uname -r

    The output from this command should confirm what you found in the Synaptic Package Manager. In the screenshot above version 2.6.28-14 is the kernel currently being utilized by Ubuntu. Take note of it. We do not want to remove that one! Note that your latest version may differ.

  3. In the same terminal window execute the following command after modifying it with the kernel version you wish to remove.
    sudo apt-get remove --purge 2.6.2x-yz-*

    As an example, if I wanted to remove kernel 2.6.28-11, I would enter this command.

    sudo apt-get remove --purge 2.6.28-11-*

  4. Allow the cleanup to run. Your Grub menu will also be automatically updated to reflect the removed kernel.

That’s it! Simple, wasn’t it? All you have to do now is repeat the steps for other old kernels that you wish to remove.

About these ads

Written by falcon1986

14 February, 2010 at 10:30 AM

Posted in Linux

Tagged with ,

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: