The main point is, that even after old kernels are removed, the following files are left back inside /lib/modules for each previous kernel: (for AMD64)
For Raspberry Pi, the files are 2-4 times larger, amounting to 3-4 MB per old kernel.
Recently, @ian-weisser encouraged me to bring this issue here.
Is this working as intended, or is it a bug that all files are not cleaned out of /lib/modules for old kernels? I have a hard time seeing the point of these files being left back.
I use Ubuntu 22.04 Server, but the problem was also present on Ubuntu 20.04 Server. And both for AMD64 and RasPi 4.
Did you add --purge option when you removed the kernel? If not, execute dpkg -l | grep 'rc ' to find the packages and sudo dpkg -P to remove them.
If you do removed the kernel completely, and dpkg shows no such packages, just rm these files, it doesnât matter.
I think everyone agree that you can remove those files manually. The point is that it shouldnât be necessary to use manual cleanup or removal of those files that are not used, and that should be removed as part of the automatic kernel cleanup.
does the job.
~c finds the packages that were removed but not purged. the single quotes prevent the bash from expanding ~c as $HOME/c
The module files apparently fall under the category of config files , which means they are not removed with a normal apt autoremove , but only removed if you provide the --purge option.
Time to lock this post as it is suspiciously close to a technical support/help request, or a bug report, which arenât allowed here. The Finding Help topic details where you can get support for Ubuntu.
Furthermore, thereâs no reason to revive topics like this that have been done for a year. Letâs open new topics when that happens. However, if this truly is a bug, open a bug report.