I seem to be stuck with a few extra files in my /boot/ partition (which every couple of kernel upgrades fills up; I really should repartition it, but I don't want to take this system offline for that long), despite using the more common methods of clearing it out. Are these files safe to just remove using the rm command?
Here are the current files in /boot/ by ls -l:
-rw-r--r-- 1 root root 217278 Jul 2 2019 config-4.15.0-55-generic
-rw-r--r-- 1 root root 237730 Jan 27 14:44 config-5.4.0-66-generic
-rw-r--r-- 1 root root 237850 Feb 19 09:11 config-5.4.0-67-generic
-rw-r--r-- 1 root root 237850 Mar 19 05:57 config-5.4.0-70-generic
drwxr-xr-x 5 root root 1024 Apr 9 08:55 grub
-rw-r--r-- 1 root root 11653168 Jun 15 2020 initrd.img-3.2.0-5.3.0.1026.13-generic-pae
-rw-r--r-- 1 root root 11653094 Jun 15 2020 initrd.img-3.2.0-5.3.0-1026.28~18.04.1-generic-pae
-rw-r--r-- 1 root root 14689421 Jun 13 2020 initrd.img-5.3.0-1026.28-generic
-rw-r--r-- 1 root root 82256762 Nov 19 09:35 initrd.img-5.4.0-53-generic.dpkg-bak
-rw-r--r-- 1 root root 22092800 Nov 19 10:37 initrd.img-5.4.0-53-generic.new
-rw-r--r-- 1 root root 83272585 Apr 9 09:01 initrd.img-5.4.0-70-generic
drwx------ 2 root root 12288 Nov 25 2017 lost+found
-rw------- 1 root root 4051807 Jul 2 2019 System.map-4.15.0-55-generic
-rw------- 1 root root 4746873 Jan 27 14:44 System.map-5.4.0-66-generic
-rw------- 1 root root 4749481 Feb 19 09:11 System.map-5.4.0-67-generic
-rw------- 1 root root 4749710 Mar 19 05:57 System.map-5.4.0-70-generic
-rw------- 1 root root 11688832 Jan 27 14:44 vmlinuz-5.4.0-66-generic
-rw------- 1 root root 11754368 Feb 19 09:11 vmlinuz-5.4.0-67-generic
-rw------- 1 root root 11756288 Mar 19 06:01 vmlinuz-5.4.0-70-generic
uname -r output:
5.4.0-70-generic
I've run this command, following the instructions at How do I free up more space in /boot?:
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]'
It returns nothing.
I do see references to the 5.4.0-66/67 if I run
dpkg -l linux-image-\* | grep ^ii
Output:
ii linux-image-5.4.0-70-generic 5.4.0-70.78 amd64 Signed kernel image generic
ii linux-image-generic 5.4.0.70.73 amd64 Generic Linux kernel image
ii linux-image-unsigned-5.4.0-66-generic 5.4.0-66.74 amd64 Linux kernel image for version 5.4.0 on 64 bit x86 SMP
ii linux-image-unsigned-5.4.0-67-generic 5.4.0-67.75 amd64 Linux kernel image for version 5.4.0 on 64 bit x86 SMP
I have not found any way to pull up 4.15.0-55, 3.2.0-5.3.0-1026, or 5.3.0-1026.28. I'm also not clear on how to remove the unsigned 5.4.0-66 and 5.4.0-67 kernels.
Is it just safe to delete those initrd.img, config, vmlinuz, and system.map files? Is there a better command for locating those files?
...or are they there and useful/should be kept?
Thanks.
I get a pile of different "RC" status packages, not just old linux-images, from dpkg --list |grep "^rc". Is it safe generally to nuke them all using "dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge"?
– Databoy2k Apr 09 '21 at 17:31