24

I have a 2G home partition, /lib/modules is taking more that 1.5G. I got 12 directory named after version of kernel 2.6.32 each taking 119k. Why do I have all of that? Do I need all of that? If not, what is the clean way to remove what I don't need?

Thanks

1 Answers1

22

Automatic update is installing each new kernel, but there is no clean-up, and there is a copy of the module for each kernel.

There is a package entry called :

linux-image-<version>-generic

Removing it removed the corresponding files in /lib/modules

  • 11
    This is correct, but there are more complete instructions for cleanup at http://askubuntu.com/questions/2793/how-do-i-to-remove-or-hide-old-kernel-versions-to-clean-up-the-boot-menu – Amanda Apr 28 '13 at 23:51
  • 8
    sudo apt autoremove does this for you in current Ubuntu versions. No need to manually clean the files. – Kasun Gajasinghe Jun 13 '18 at 09:49
  • 2
    Autoremove does not work for me. But sudo apt-get purge linux-image-4.15.0-45-generic does. – Sridhar Sarnobat Apr 08 '19 at 02:59
  • Is this safe to do ? What am i looking in here ? What are those packages ? – Raul Chiarella Apr 13 '22 at 19:26
  • somehow ubuntu can't remove /lib/modules/ dirs, even with purge. I receive the error rmdir: failed to remove '/lib/modules/5.15.0-88-generic': Directory not empty – nulll Dec 12 '23 at 17:42