I had to install a kernel update on my work laptop that is running Xubuntu, and it wouldn’t download because I had run out of space in /boot. That’s almost always caused from having too many kernel image files saved there from previous updates.
Well I found a really cool one-line command that removes all kernel images except the current one. That command is:
export KERNEL=”$(uname -r | grep -Po ‘([0-9.-]*[0-9])?’)”; dpkg –get-selections | grep -E “linux-(header|image).*” | grep -iw install | sort | grep -v “$KERNEL” | grep -v “lts” | sed ‘s/install//g’ | xargs dpkg -P
You can put that in a convenient script if you like for future use!