I did some digging around and found that the automatic clean-up for kernels is in /etc/kernel/postinst.d/apt-auto-removal
and the file states:
# In the common case this results in two kernels saved (booted into the
# second-latest kernel, we install the latest kernel in an upgrade), but
# can save up to four. Kernel refers here to a distinct release, which can
# potentially be installed in multiple flavours counting as one kernel.
but that script is way above my head and I cannot easily find how autoclean anything but the last 4 kernels.
What it means when it says "up to four" is that the currently running, current installed, latest, and previous versions can all be different, resulting in four versions being automatically kept (with a minimum of two). See this part of the code:
I think the simplest way to get it to save older kernels would be to extend the
$previous_version
to a list. Instead of:Do: