Problem Description: Unable to keep more than 2 kernels
In old releases to keep more kernel limiting autoremove it was possible to change
the file /etc/kernel/postinst.d/apt-auto-removal
now this file no longer exist and i’m unable to keep more than 2 kernels.
please help
I have just read that thread, and IMO the workaround there is unnecessarily tying itself in a thousand knots to be “nice” and follow the Ubuntu Way.
What I do on my system (Pop-OS, derived from jammy): I have a “backup-kernel” script that just copies all “kernel-related” files from a particular version to names that are outside of the convention followed by the apt installed kernels. Example:
(the new part encodes the date when the backup was made).
You only need to do this with precisely 5 paths:
vmlinuz as above
config
System.map
initrd.img-*
lib/modules/*
And then be sure the bootloader sees the backed up versions. I think this is trivial for grub, just running update-grub should work; for EFI, it took me some further scripting, but not longer than a half-page of perl code.
Can somebidy enlighten me of the reason why they need more than two kernels, the most current version and the previously installed version that worked.
I’ve never had more than two and have never seen any reason to do so but perhaps I’m missing something potentially important here.
When ubuntu makes its polite suggestion that I might consider an autoremove
I just politely ignore it.
So I just keep as many kernels as I want at the time.
If something else comes up that ought to be autoremoved,
i just remove it manually, never running autoremove.
While many other things in life have caused me problems, this hasn’t.