Hi,

As we have seen some modules directories are larger than others. I was just 
cleaning up some old stuff and this is what I noticed.

------<Quote>---------------------
xxxxxxx:/usr/lib/modules# du * -sh
4.7M    5.10.0-16-amd64
309M    5.10.0-18-amd64
309M    5.10.0-19-amd64
309M    5.10.0-20-amd64
309M    5.10.0-21-amd64
309M    5.10.0-22-amd64

xxxxxxx:/usr/lib/modules# dpkg --purge linux-image-5.10.0-16-amd64
(Reading database ... 57223 files and directories currently installed.)
Purging configuration files for linux-image-5.10.0-16-amd64 (5.10.127-2) ...

xxxxxxx:/usr/lib/modules# dpkg --purge linux-image-5.10.0-17-amd64
dpkg: warning: ignoring request to remove linux-image-5.10.0-17-amd64 which 
isn't installed

xxxxxxx:/usr/lib/modules# dpkg --purge linux-image-5.10.0-18-amd64
(Reading database ... 57222 files and directories currently installed.)
Removing linux-image-5.10.0-18-amd64 (5.10.140-1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.10.0-18-amd64
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.10.0-22-amd64
Found initrd image: /boot/initrd.img-5.10.0-22-amd64
Found linux image: /boot/vmlinuz-5.10.0-21-amd64
Found initrd image: /boot/initrd.img-5.10.0-21-amd64
Found linux image: /boot/vmlinuz-5.10.0-20-amd64
Found initrd image: /boot/initrd.img-5.10.0-20-amd64
Found linux image: /boot/vmlinuz-5.10.0-19-amd64
Found initrd image: /boot/initrd.img-5.10.0-19-amd64
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
done
Purging configuration files for linux-image-5.10.0-18-amd64 (5.10.140-1) ...
xxxxxxx:/usr/lib/modules# 
------<Quote>---------------------

So kernel 16 was removed before the step but there was some stuff left in the 
modules folder.
Kernel 17 was never on the system it seems.
Purging kernel 18 removed a still installed kernel. :-(

Rebooting the machine still gave me a working server so whatever it removed of 
18 which caused it to rebuild the grub config did not cause any problems.
It seems lately there are more older kernels kept on the system, not just the 
last and the previous one. However, keeping 5 kernels seems a bit overkill (18, 
19, 20, 21 and 22)
Although, I have no idea where it says how many kernels to keep

------<Quote>---------------------
# cat /etc/apt/apt.conf.d/01autoremove
APT
{
  NeverAutoRemove
  {
        "^firmware-linux.*";
        "^linux-firmware$";
        "^linux-image-[a-z0-9]*$";
        "^linux-image-[a-z0-9]*-[a-z0-9]*$";
  };

  VersionedKernelPackages
  {
        # kernels
        "linux-.*";
        "kfreebsd-.*";
        "gnumach-.*";
        # (out-of-tree) modules
        ".*-modules";
        ".*-kernel";
  };

[....]
------<Quote>---------------------

Even wierder, on other systems I only have the last 2 kernels, 21 and 22.  
On the one that is not running all that long, as of Nov 2022, it seems it 
started with kernel 13, then 19, 20, 21 and 22. 
Those are also the 5 modules folders on that system, but in /boot there are 
only 21 and 22.

I am going to clean up older kernels so I have only the last 2 and see where 
things go from there. 
>From now on I am going to keep better track on the number of kernels on the 
>system. 

Bonno Bloksma

Reply via email to