Using apt full-upgrade
is also useful to avoid filling up your /boot
with kernel images and initrds. A simple apt upgrade
will not remove packages and thus not clean up old kernel images. If you want to keep track of Debian unstable, then you indeed should be using apt full-upgrade
.
Does it delete all of them? Would this make it harder to recover if e.g. a new kernel doesn’t boot?
Is that very different than doing an “apt autoremove” after updating?
apt will keep the following kernels:
- the one you currently have booted
- the installed kernel with the highest version
- the installed kernel with the second-highest version
- kernel packages that are not marked as automatically installed
Thus, even if your system is running for a very long time and you are performing more than one kernel upgrade in that time and if the new kernel happens to be broken and if you did not manually mark a previously installed kernel as manually installed, you will still be able to boot into the kernel you had running before you rebooted, because apt will keep the kernel that you were running at the time that you ran “apt autoremove” or “apt full-upgrade”.
Reading apt’s source code, running “apt autoremove” seems to be performing the same kernel cleanup as “apt full-upgrade”. Please somebody correct me if you see something different happening in practice.
To prevent a package from being autoremoved, you can always mark it as manually installed. This is what also happens with packages that you manually “apt install”. In case of kernel packages, they usually get installed because linux-image-mnt-reform-arm64
gets upgraded and the new version then depends on a new linux-image-X.Y.Z-mnt-reform-arm64
package. Since you do not manually install linux-image-X.Y.Z-mnt-reform-arm64
but since it is pulled in as a dependency of another package, it is marked as being “automatically” installed. And those packages are candidates for autoremoval. To mark a package as manually installed and thus prevent apt from automatically removing them with “apt autoremove” or “apt full-upgrade”, use the “apt-mark” tool, and for example run:
apt-mark manual linux-image-X.Y.Z-mnt-reform-arm64