Hello
Some time ago I posted this question on Ask Ubuntu.
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)
$ ls -l
-rw-r--r-- 1 root 143K 2022-04-28 18:36 modules.alias
-rw-r--r-- 1 root 154K 2022-04-28 18:36 modules.alias.bin
-rw-r--r-- 1 root 8.0K 2022-04-08 10:44 modules.builtin
-rw-r--r-- 1 root 25K 2022-04-28 18:36 modules.builtin.alias.bin
-rw-r--r-- 1 root 11K 2022-04-28 18:36 modules.builtin.bin
-rw-r--r-- 1 root 63K 2022-04-08 10:44 modules.builtin.modinfo
-rw-r--r-- 1 root 85K 2022-04-28 18:36 modules.dep
-rw-r--r-- 1 root 123K 2022-04-28 18:36 modules.dep.bin
-rw-r--r-- 1 root 268 2022-04-28 18:36 modules.devname
-rw-r--r-- 1 root 215K 2022-04-08 10:44 modules.order
-rw-r--r-- 1 root 489 2022-04-28 18:36 modules.softdep
-rw-r--r-- 1 root 279K 2022-04-28 18:36 modules.symbols
-rw-r--r-- 1 root 326K 2022-04-28 18:36 modules.symbols.bin
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.