Bookmark and Share

If you are new to Unixmen, you may want to subscribe :

Everytime there is an update for the kernel, the new kernel is installed while the old one is not automaticaly uninstalled, after several kernel updates, you will find a large list of old kernels in the start grub menu . So if we got no problem with the new installed kernel, we can just delete the old ones.

Today i will show you how to uninstall the old kernels, it is important to keep at least one old kernel, so in case if you have any problem with the new one, you can then  switch to the old kernel.


First use this command to see the list of the installed kernels in your Ubuntu : 

$ dpkg --get-selections | grep linux-image

In my case :

Now for example try to delete the oldest one (change oldest kernel with your oldest one) :

$ sudo apt-get purge oldest-kernel 

In my case :

$ sudo apt-get purge linux-image-2.6.31-14-generic

If the kernel you try to uninstall is not updated, you will got a message to update first before to continue. update then the kernel and then uninstall that old kernel and the updates using the same command above.

Important : Do not uninstall the linux-image-generic as it is necessary to receive updates of the kernel.

Thanks to guia ubuntu for this tip ( In spanish)



Related Articles By Tags:

Comments (4)
  • Giorgos
    avatar

    Or just uninstall them, with Ubuntu Tweak! :D

  • Rajasun
    avatar

    An alternative method is as such:
    1.
    For a listing of unused linux headers, image, and modules:

    dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

    2.
    To purge them:
    sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

    Also do have a look at http://ubuntuforums.org/showpost.php?p=8514471& postcount=10

  • tuxicity  - autoremove
    avatar

    In 9.10 you get this message :
    The following packages were automatically installed and are no longer required:
    linux-headers-2.6.31-14 linux-headers-2.6.31-14-generic
    Use 'apt-get autoremove' to remove them.
    So sudo apt-get autoremove does the trick.
    This tip is obsolete. 8)

  • Rico Chopete  - Warnings
    avatar

    When you get warnings of this kind, what should you do AND WHY does this happen?

    dpkg - warning: while removing linux-headers-2.6.24-19-generic, directory `/lib/modules/2.6.24-19-generic' not empty so not removed.

    dpkg - warning: while removing linux-ubuntu-modules-2.6.24-16-generic, directory `/lib/firmware/2.6.24-16-generic' not empty so not removed.

    rmdir: failed to remove `/lib/modules/2.6.24-19-generic': Directory not empty
    dpkg - warning: while removing linux-image-2.6.24-19-generic, directory `/lib/modules/2.6.24-19-generic/kernel/drivers/ input/misc' not empty so not removed.

Write comment
Your Contact Details:
Gravatar enabled
Comment:
[b] [i] [u] [s] [url] [quote] [code] [img]   
:D:):(:0:shock::confused:8):lol::x:P:oops::cry:
:evil::twisted::roll::wink::!::?::idea::arrow: