2

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.

2

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.

  • Didn't work..Same result as sudo apt-get purge linux-image-3.18.0-rc1-00326-g3d85e2c-dirty :( – user297666 Nov 8 '14 at 10:23
  • my ls vmlinuz* gives me this result: vmlinuz-3.13.0-24-generic vmlinuz-3.18.0-rc1+ vmlinuz-3.13.0-24-generic.efi.signed vmlinuz-3.18.0-rc1-00314-gb0ef3ed vmlinuz-3.17.0-rc5+ vmlinuz-3.18.0-rc1-00314-gb0ef3ed.old vmlinuz-3.17.0-rc6 vmlinuz-3.18.0-rc1-00326-g3d85e2c-dirty vmlinuz-3.17.0-rc6+ vmlinuz-3.18.0-rc1+.old – user297666 Nov 8 '14 at 10:45
  • In this case I really think those files are orphans, so you can remove them manually. – diegov Nov 10 '14 at 12:59
  • Actually I was worried for other files which are linked with it. But yeah it worked. They were orphans. May be I needed someone just to say that go and remove them. Thanks :) – user297666 Nov 12 '14 at 4:43
  • @user297666, if you have previously removed a package without purging it, purging it does not work. I suppose you could reinstall the package and purge it thereafter to remove all (system wide?) configuration, too. – jarno Dec 23 '15 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.