Old kernel files in /boot

Some days ago I was also affected by the “no space left on device” situation below /boot. In my case the installation failed, the L5 remained boot-able and I could remove the older kernels. Today I see, that the removal was not fully complete:

purism@pureos:~$ apt list 2>/dev/null | grep linux-image | grep installed
linux-image-5.16.0-1-librem5/byzantium,now 5.16.3pureos1 arm64 [installed,automatic]
linux-image-librem5/byzantium,now 5.16.3pureos1 arm64 [installed]
purism@pureos:~$ find /boot/dtbs
/boot/dtbs
/boot/dtbs/5.13.0-1-librem5
/boot/dtbs/5.13.0-1-librem5/freescale
/boot/dtbs/5.13.0-1-librem5/freescale/imx8mq-librem5-r4.dtb.bak
/boot/dtbs/5.13.0-1-librem5/imx8mq-librem5-r4.dtb
/boot/dtbs/5.15.0-1-librem5
/boot/dtbs/5.15.0-1-librem5/freescale
/boot/dtbs/5.15.0-1-librem5/freescale/imx8mq-librem5-r4.dtb.bak
/boot/dtbs/5.15.0-1-librem5/imx8mq-librem5-r4.dtb
/boot/dtbs/5.16.0-1-librem5
/boot/dtbs/5.16.0-1-librem5/freescale
/boot/dtbs/5.16.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
/boot/dtbs/5.16.0-1-librem5/freescale/imx8mq-librem5-r4.dtb.bak
/boot/dtbs/5.16.0-1-librem5/imx8mq-librem5-r4.dtb

Why are the 5.13.0-1-librem5 and 5.15.0-1-librem5 files are still there?

I haven’t checked, but try sudo apt purge linux-image-5.13.0-1-librem5.

FWIW these are just small device tree files.

1 Like
purism@pureos:~$ sudo apt purge linux-image-5.13.0-1-librem5
[sudo] password for purism: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-image-5.13.0-1-librem5
E: Couldn't find any package by glob 'linux-image-5.13.0-1-librem5'

If those are considered by the package to be configuration files then they are still there because you did apt remove ... rather than apt purge ...

You should be able to apt purge ... even after a package has been removed.

Maybe check the package name and status with
apt list | grep '^linux-image-.*-librem5'

1 Like

I should clarify that this is a general statement about the behaviour of the package management system.

If your system has got itself in a mess or some files have been manually deleted outside of the package management system then the actual behaviour might be different.

Nevertheless, it is still a good idea to use the above apt list | ... command to ask the package management system what it thinks is the current situation.

These dtb files are being put into /boot by flash-kernel, so it’s possible that they’re not being tracked by package manager at all (my suggestion to try purge was just an educated guess). Removing these old files manually should be fine then - but personally I wouldn’t bother, they take something around 50KB of space :wink:

1 Like

Hence why the above apt list | ... command is needed - it will show whether there is “residual-config”.

1 Like

I do not fully understand, what this grep has to do with the old files, but here we go:

purism@pureos:~$ apt list | grep '^linux-image-.*-librem5'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

linux-image-5.16.0-1-librem5/byzantium,now 5.16.3pureos1 arm64 [installed,automatic]
2 Likes

In order to gain further space, and especially now when it is clear that your big files like:

play no significant role any more, within your Librem 5 /boot partition, you might consider to remove them completely away (if not already done). And, @irvinewade, many thanks for sharing with us here this very relevant CLI command! As written here: