On Freya, in a virtual machine sudo apt-get autoremove does not anything. I wanted to free up some disk space and it has no packages to remove, but there should be packages like old kernels, etc.


2 Answers 2


apt-get autoremove does not remove old kernels (by design). If you want to free up some space by removing old kernels you have to do this manually, but it's advised that the latest two kernel versions remain.

How-to remove old kernels manually

Fair warning: You should only mess with kernels (removing as well as manually installing new ones) if there is a need for it (space constraints or problems with the current kernel). Figuratively the kernel is the heart of your system, elementary really can't live without it!

Lines starting with $ denote commands you have to input in terminal, the following text is example output from my machine.

First display the kernel you are currently using, you want to keep that:

$ uname -r

Then list all currently installed kernels:

$ dpkg -l | grep linux-image-
ii  linux-image-3.13.0-62-generic               3.13.0-62.102                                                   amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-46-generic               3.16.0-46.62~14.04.1                                            amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-26-generic               3.19.0-26.28~14.04.1                                            amd64        Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-62-generic         3.13.0-62.102                                                   amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-46-generic         3.16.0-46.62~14.04.1                                            amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-26-generic         3.19.0-26.28~14.04.1                                            amd64        Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-generic-lts-vivid                                                         amd64        Generic Linux kernel image

This means there are currently three kernels installed. The last entry for linux-image-generic-lts-vivid is a meta package which does not use much disk space (from installing the Ubuntu Vivid kernel in Freya) and should not be removed.

You can now remove kernels you don't need anymore. Make sure to at least keep two kernels around, which should be the absolute minimum so you have at least one backup if the most recent kernel fails.

$ sudo apt-get autoremove linux-image-3.13.0-62-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  linux-image-3.13.0-62-generic linux-image-extra-3.13.0-62-generic
0 to upgrade, 0 to newly install, 2 to remove and 0 not to upgrade.
After this operation, 194 MB disk space will be freed.
Do you want to continue? [Y/n] y

You can now check the list of installed kernels again with dpkg -l | grep linux-image-. If a line starts with rc this only means there is residual config files remaining (uses little to no space).

Adapted from Ubuntu documentation wiki, written by its contributors (cc-by-sa 3.0).

  • I definitely used autoremove to free up disk (also kernels were uninstalled) space on other ubuntu based distributions o_O
    – bigfatbird
    Aug 26, 2015 at 16:12
  • Upon reading further I'm not sure what the expected behaviour is anymore, so I have added instructions on how-to manually remove old kernels.
    – quassy
    Aug 26, 2015 at 17:38
  • I just fired up autoremove with no additional comment on my Ubuntu Machine and it definitely removes Kernels by itself. So I'm wondering if this might be something else there. See my screenshot! imgur.com/8N8MXIq
    – bigfatbird
    Aug 27, 2015 at 11:02
  • Well it will only do that if you have multiple kernels installed, check dpkg -l | grep linux-image-
    – quassy
    Aug 27, 2015 at 13:44
  • 1
    Of course i have. I updated elementary many times, the kernels where installed and installed and installed, the vm ran out of space and I tried autoremove, but it did nothing. That’s why I’m here ;)
    – bigfatbird
    Aug 27, 2015 at 13:47

You can use apt-get autoremove to free space if there are things in your disk that aren't necessary for the system anymore. If you run apt-get upgrade there you'll see a message that will tell you if there are things that you can remove with apt-get autoremove.

Something like this:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree     
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  libassuan0 libgmime-2.6-0 libgpgme11 libmessaging-menu0
Use 'apt-get autoremove' to remove them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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