Because 'apt autoremove' will remove the pkgs installed from 'apt
install', some old pkgs, eg. some old kernels are for vmware modules
updated. can be not removed.
Vmware modules cannot be compiled in the new kernel 6.8.0-40.
cf: https://help.ubuntu.com/community/RemoveOldKernels#GUI_Way
The packages to remove are determined based in part
on whether the package is marked as manually or automatically installed.
You can check if a kernel providing package is marked as automatically
installed using this command in a terminal:
apt-mark showauto 'linux-image-.*'
or to see if it is marked as manually installed:
apt-mark showmanual 'linux-image-.*'
In
the event some kernel providing packages are marked as manual (possibly
because they were installed via 'apt-get') and you want them
autoremoved, you can change the status of the package using apt-mark auto and the package name. For example, to mark kernel 4.12.0-12-generic as autoremovable:
sudo apt-mark auto '^linux-.*-4\.12\.0-12(-generic)?$'
On the contrary, I want some kernels not to be autoremoved. So do this,
sudo apt-mark manual linux-headers-6.5.0-45-generic
sudo apt-mark manual linux-hwe-6.5-headers-6.5.0-45
sudo apt-mark manual linux-image-6.5.0-45-generic
sudo apt-mark manual linux-modules-6.5.0-45-generic
sudo apt-mark manual linux-modules-extra-6.5.0-45-generic
sudo apt-mark manual linux-signatures-nvidia-6.5.0-45-generic
sudo apt-mark manual linux-headers-5.15.0-118
sudo apt-mark manual linux-headers-5.15.0-118-generic
sudo apt-mark manual linux-image-5.15.0-118-generic
sudo apt-mark manual linux-modules-5.15.0-118-generic
sudo apt-mark manual linux-modules-extra-5.15.0-118-generic