jump to navigation

How to Delete Old Kernels in Ubuntu February 6, 2010

Posted by admin in : Internet Tips, Others , trackback

ubuntu How to Delete Old Kernels in UbuntuEvery time there is update to the kernel, then the new kernel will be installed while the old kernel does not automatically deleted (uninstalled), so we’ll see a list of old kernels that is long enough in the grub menu at start.

If we do not have a problem with the new kernel is installed so we can remove the kernels long. But also needs to retain at least one old kernel in case the new kernel if future problems.

There are two ways that can be done to remove the old kernels in Ubuntu :

First way

1. Discover all the packages related to the kernel that is installed on the system. The command is:

jafar@k4tz:~$ dpkg -l / grep linux

or

jafar@k4tz:~$ dpkg –get-selections / grep linux

2. Clear all linux-headers-*, linux-image-* or something like the kernel does not want us to save. Example command:

jafar@k4tz:~$ sudo aptitude –purge remove linux-headers-2.6.31-14-generic linux-image-2.6.31-14-generic linux-restricted-modules-2.6.31-14-generic linux-backports-modules-2.6.31-14-generic

3. Then wipe again from the package configuration and obsolescence that may still remain our alias net-clean system. The command:

jafar@k4tz:~$ sudo deborphan | xargs sudo apt-get -y remove –purge && sudo deborphan –guess-data | xargs sudo apt-get -y remove –purge; sudo apt-get autoremove && sudo aptitude purge ‘~c’; sudo apt-get autoclean

Second way

1. To see the linux headers, images, and the unused modules use the following command:

jafar@k4tz:~$ dpkg -l ‘linux-*’ | sed ‘/^ii/!d;/’”$(uname -r | sed “s/\(.*\)-\([^0-9]\+\)/\1/”)”‘/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d’

2. Then cleaned by using the following command:

jafar@k4tz:~$ 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

Reference:

Ubuntuforums.org

Description:

- The second is more easy and practical to do if we do not really understand where all you need to be removed

- Be careful to remove it, if not sure then you should not need to be removed

If you enjoyed this post, make sure you subscribe to my RSS feed!
Tags:

Comments»

1. Linux Kernel 2.6.33.4 is Out! - Open Source and Linux | TechEnclave - May 17, 2010

[...] Originally Posted by Yondaime Thanks, I was to ask a question relating the kernel installation, in an update Ubuntu installed a new kernel now when I boot i have two kernels with diff. ver. obviously ! was about to ask if I can/should remove the older one. Here: How to Delete Old Kernels in Ubuntu | ICT Learning [...]



Recent Search:
  ubuntu delete old kernels (4)  purge linux headers (3)  removing linux-backports-modules-2 6 31-14-generic (3)  ubuntu auto remove old kernel (3)  ubuntu remove old kernels (3)  ubuntu remove old kernel installation (3)  ubuntu 10-04 remove unused kernel images (2)  ubuntu erase old kernel (2)  ubuntu autoremove old kernels (2)  ubuntu remove unused kernels (2)