Sunday, May 6, 2018

apt - Can't delete all unused kernels


I am trying to remove all my unused kernels but it is not working. My dpkg --list | grep linux-image result is as follows:


ii  linux-image-3.13.0-24-generic                         3.13.0-24.46                                        amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-24-generic 3.13.0-24.46 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.24.28 amd64 Generic Linux kernel image

It is not showing any other kernel entries whereas there are many. ls /lib/modules gives me this result:


   3.13.0-24-generic  3.17.0-rc6+                3.18.0-rc1-00326-g3d85e2c-dirty
3.17.0-rc5+ 3.18.0-rc1+
3.17.0-rc6 3.18.0-rc1-00314-gb0ef3ed

Currently I am running 3.18.0-rc1+ and I wants to remove all other 3.18.xxx versions but no command is working. I ran sudo apt-get purge linux-image-3.18.0-rc1-00326-g3d85e2c-dirty but it is showing following output:


Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-3.18.0-rc1-00326-g3d85e2c-dirty
E: Couldn't find any package by regex 'linux-image-3.18.0-rc1-00326-g3d85e2c-dirty'

I also tried sudo apt-get autoremove but it is showing following output:


Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 420 not upgraded.

I am confused now. Please help me.



Those remaining folders of already purged kernels are only links to the headers/source files of those kernels.


So, you can get rid of them purging the respective headers files, like:


sudo apt-get --purge remove linux-headers-3.18.0-rc1-00326-g3d85e2c-dirty


Look, I suggest you to use --purge remove directive to clean it all up. Also, If you remove future kernel only image with --purge remove, you will also get ride of the /lib/modules links, even not purging the headers files.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...