I wanted to upgrade my Ubuntu 18.04 but could not do that because there is not enough space available in /boot.
The content of /boot is:
System.map-4.15.0-173-generic System.map-4.15.0-204-generic System.map-4.15.0-29-generic abi-4.15.0-29-generic config-4.15.0-173-generic config-4.15.0-204-generic config-4.15.0-29-generic grub initrd.img-4.15.0-204-generic lost+found retpoline-4.15.0-29-generic vmlinuz-4.15.0-173-generic vmlinuz-4.15.0-204-generic vmlinuz-4.15.0-29-generic
Following How do I free up more space in /boot? I did `sudo apt purge -y linux-{image,headers}-VERSION for all VERSIONs other than the one loaded.
This indeed removed all those version, the command dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}'
shows:
linux-headers-4.15.0-204 linux-headers-4.15.0-204-generic linux-image-4.15.0-204-generic
However, it did NOT remove any files from /boot - so the accepted answers for this problem did not work at all for me. Are there any alternatives?
UPDATE: the output of apt-mark showmanual | grep linux-'[g|h|m|i]'
is
linux-generic linux-headers-generic
Is it possible und safe to simple sudo rm ...
the files that belong to unneded versions?
UPDATE: I started with trying sudo apt autoremove --purge
which did not do anything at all.
UPDATE: output of dpkg -l | grep linux-'[g|h|i|m|e]' | cut -d ' ' -f 3
is
binutils-x86-64-linux-gnu linux-generic linux-headers-4.15.0-204 linux-headers-4.15.0-204-generic linux-headers-generic linux-image-4.15.0-204-generic linux-image-generic linux-image-unsigned-4.15.0-173-generic linux-image-unsigned-4.15.0-29-generic linux-modules-4.15.0-173-generic linux-modules-4.15.0-204-generic linux-modules-4.15.0-29-generic linux-modules-extra-4.15.0-204-generic
UPDATE: output of for f in /boot/* ; do dpkg -S $f ; done | grep -v 204-generic | cut -f 1 -d ":"
is :
linux-modules-4.15.0-173-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-173-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-29-generic linux-image-unsigned-4.15.0-173-generic linux-image-unsigned-4.15.0-29-generic
Removing them all with for f in /boot/* ; do dpkg -S $f ; done | grep -v 204-generic | cut -f 1 -d ":" | xargs -n 1 sudo apt purge -y
:
This indeed removed all the unnecessary files in /boot - thank you @user535733 who shared the relevant idea in the comments!