root@DietPi:~# dpkg -l linux-image*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================================-============-============-===================================
ii linux-image-6.12.57+deb13-amd64 6.12.57-1 amd64 Linux 6.12 for 64-bit PCs (signed)
un linux-image-6.12.57+deb13-amd64-unsigned <none> <none> (no description available)
ii linux-image-6.12.63+deb13-amd64 6.12.63-1 amd64 Linux 6.12 for 64-bit PCs (signed)
un linux-image-6.12.63+deb13-amd64-unsigned <none> <none> (no description available)
ii linux-image-amd64 6.12.63-1 amd64 Linux for 64-bit PCs (meta-package)
un linux-image-generic <none> <none> (no description available)
root@DietPi:~#
We remove /etc/apt/apt.conf.d/01autoremove from our images, but it is coming back by times. /etc/apt/apt.conf.d/01autoremove.dpkg-dist should actually not be effective, is it? The .dpkg-dist suffix indicates that dpkg added this since the actual “config file” was manually removed. So it does not restore removed configs by default, but installs them with a suffix, same as if a config file is manually edited, it does not just overwrite it. But if /etc/apt/apt.conf.d/01autoremove.dpkg-dist was effectively used by APT, that would be a problem .
Generally it is true that a kernel should better not be removed before the new one got loaded (after a reboot), but it is not critical. When removing the currently loaded kernel, of course kernel modules for that kernel cannot be loaded anymore. But unless specific new software is installed, like container engines, firewalls, VPN servers or such, this is rarely the case. And then you will get a moreless clear error message that the kernel module does not exist (for the loaded kernel). And e.g. dietpi-software will warn you in the first place that no kernel modules were found and that a reboot is most likely needed.
Most SBCs come with non-versioned kernel packages, i.e. linux-image-<branch>-<vendor> is upgraded, implying the removal of old kernel and modules. So that “safety” feature keeping old kernels is x86_64, and was only recently added to RPi packaging, with the release of the RPi 5. And there it is possibe only due to separation of /boot and /boot/firmware, otherwise the limited RPi boot partition would be full quickly, especially with autoremove-protection in place .
root@DietPi:~# dpkg -l linux-image*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================================-============-============-===================================
ii linux-image-6.12.57+deb13-amd64 6.12.57-1 amd64 Linux 6.12 for 64-bit PCs (signed)
un linux-image-6.12.57+deb13-amd64-unsigned <none> <none> (no description available)
ii linux-image-6.12.63+deb13-amd64 6.12.63-1 amd64 Linux 6.12 for 64-bit PCs (signed)
un linux-image-6.12.63+deb13-amd64-unsigned <none> <none> (no description available)
ii linux-image-amd64 6.12.63-1 amd64 Linux for 64-bit PCs (meta-package)
un linux-image-generic <none> <none> (no description available)
root@DietPi:~#
Just installed Kernel : 6.12.74+deb13+1-amd64 and did a reboot. Than used
apt autoremove
This removed the old version.
But there are still leftovers that need to be removed manually:
root@DietPi:~# dpkg --list | grep linux-image
rc linux-image-6.12.73+deb13-amd64 6.12.73-1 amd64 Linux 6.12 for 64-bit PCs (signed)
ii linux-image-6.12.74+deb13+1-amd64 6.12.74-2 amd64 Linux 6.12 for 64-bit PCs (signed)
ii linux-image-amd64 6.12.74-2 amd64 Linux for 64-bit PCs (meta-package)
root@DietPi:~#
Using:
apt purge linux-image-6.12.73+deb13-amd64
than it looks like:
root@DietPi:~# dpkg --list | grep linux-image
ii linux-image-6.12.74+deb13+1-amd64 6.12.74-2 amd64 Linux 6.12 for 64-bit PCs (signed)
ii linux-image-amd64 6.12.74-2 amd64 Linux for 64-bit PCs (meta-package)
root@DietPi:~#