ūüĖ• Delete old Linux kernels in¬†/boot partition

Sometimes one need to free up /boot partition, for example, to perform release upgrade using do-release-upgrade command. /boot partition may contain some outdated and unused kernels and here’s how to remove them:

Get current kernel

$ uname -r

Note: this kernel shouldn’t be deleted.

List all installed kernels

$ dpkg --list 'linux-image*' | grep ^ii

Manually delete all kernels except current kernel

$ sudo apt remove linux-image-<version>

Free up space

Finally, perform autoremove command to remove all unused files:

$ sudo apt --purge autoremove

Check free space:

$ df -h
¬†226¬†  2022   debian   how-to   linux   tips   ubuntu