1

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.

  • Does this answer your question? How do I free up more space in /boot? – Bruni Apr 09 '21 at 15:41
  • @Bruni I've actually followed those steps - I even linked to it in my question. None of the removal lines seem to remove the unsigned kernels, the 5.3 kernels, or the 4.15 artifacts. Is there a change that I should be making to those instructions? – Databoy2k Apr 09 '21 at 15:56
  • I would think the normal dpkg command should maintain all your 5.4 versions as they should be in dpkg. Only use rm on files not in dpkg. I also used to use synaptic to find kernels & remove old ones. And always updated kernel before rebooting, just in case. But your old kernel must be from upgrading and your old install. Those 3.2 & 4.15 will have to be rm'd by version: abi, config, initrd.img, vmlinuz. Also check both /lib/modules & /usr/src for old versions. Since upgrade, you may have lots of very old logs & other cruft. Part of why a new install sometimes makes sense. – oldfred Apr 09 '21 at 16:39
  • @oldfred When I dpkg -l *4.15.0* | grep "^rc" I get a pile of linux-images that are on "RC status. Presumably this is true for the other weird ones as well.

    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
  • That is ok to run, but I do not think it will clear kernels not in dpkg list from installs before an upgrade. – oldfred Apr 09 '21 at 18:38

0 Answers0