0

During sudo apt upgrade I get the following error. Also on sudo apt autoremove --purge.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-firmware (1.187.11) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-72-generic
Error 24 : Write error : cannot write compressed block 
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-72-generic with 1.
dpkg: error processing package linux-firmware (--configure):
 installed linux-firmware package post-installation script subprocess returned e
rror exit status 1
Errors were encountered while processing:
 linux-firmware
E: Sub-process /usr/bin/dpkg returned an error code (1)

Problem might be that /boot is at 90% full. But how can I free space if autoremove does not?

uname -r shows: 5.4.0-70-generic

and /boot content is as follows:

-rw-r--r--  1 root root  1395166 Jan 20  2017 abi-4.9.5-040905-generic
-rw-r--r--  1 root root   201072 Jan 20  2017 config-4.9.5-040905-generic
-rw-r--r--  1 root root   237850 Mär 19 12:57 config-5.4.0-70-generic
-rw-r--r--  1 root root   237851 Mär 24 11:25 config-5.4.0-71-generic
-rw-r--r--  1 root root   237851 Apr 12 17:12 config-5.4.0-72-generic
drwx------  3 root root     4096 Jan  1  1970 efi/
drwxr-xr-x  5 root root     1024 Apr 19 08:17 grub/
lrwxrwxrwx  1 root root       27 Apr 19 08:16 initrd.img -> initrd.img-5.4.0-72-generic
-rw-r--r--  1 root root 17015451 Jul 13  2020 initrd.img-4.4.0-101-generic
-rw-r--r--  1 root root 61223879 Mär 15 13:29 initrd.img-4.9.5-040905-generic
-rw-r--r--  1 root root 88225085 Apr 14 09:07 initrd.img-5.4.0-70-generic
-rw-r--r--  1 root root 88228245 Apr 14 09:08 initrd.img-5.4.0-71-generic
-rw-r--r--  1 root root 88227938 Apr 19 08:17 initrd.img-5.4.0-72-generic
lrwxrwxrwx  1 root root       27 Apr 19 08:16 initrd.img.old -> initrd.img-5.4.0-71-generic
drwx------  2 root root    12288 Mai  3  2017 lost+found/
-rw-r--r--  1 root root   182704 Aug 18  2020 memtest86+.bin
-rw-r--r--  1 root root   184380 Aug 18  2020 memtest86+.elf
-rw-r--r--  1 root root   184884 Aug 18  2020 memtest86+_multiboot.bin
-rw-------  1 root root  3639920 Jan 20  2017 System.map-4.9.5-040905-generic
-rw-------  1 root root  4749710 Mär 19 12:57 System.map-5.4.0-70-generic
-rw-------  1 root root  4750202 Mär 24 11:25 System.map-5.4.0-71-generic
-rw-------  1 root root  4750202 Apr 12 17:12 System.map-5.4.0-72-generic
lrwxrwxrwx  1 root root       24 Apr 19 08:16 vmlinuz -> vmlinuz-5.4.0-72-generic
-rw-------  1 root root  7403296 Jan 20  2017 vmlinuz-4.9.5-040905-generic
-rw-------  1 root root 11756288 Mär 19 13:01 vmlinuz-5.4.0-70-generic
-rw-------  1 root root 11760384 Mär 24 11:29 vmlinuz-5.4.0-71-generic
-rw-------  1 root root 11760384 Apr 12 18:56 vmlinuz-5.4.0-72-generic
lrwxrwxrwx  1 root root       24 Apr 19 08:16 vmlinuz.old -> vmlinuz-5.4.0-71-generic

Question: which of these files can be safely removed, if apt autoremove does not on its own?

Update

$ dpkg -l "linux*" |grep "ii"
ii  linux-base                              4.5ubuntu3.1         all          Linux image base package
ii  linux-firmware                          1.187.11             all          Firmware for Linux kernel drivers
ii  linux-generic                           5.4.0.72.75          amd64        Complete Generic Linux kernel and headers
ii  linux-generic-lts-utopic                4.4.0.131.137        amd64        Complete Generic Linux kernel and headers (dummy transitional package)
ii  linux-headers-5.4.0-70                  5.4.0-70.78          all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-70-generic          5.4.0-70.78          amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-71                  5.4.0-71.79          all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-71-generic          5.4.0-71.79          amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-72                  5.4.0-72.80          all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-72-generic          5.4.0-72.80          amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-generic                   5.4.0.72.75          amd64        Generic Linux kernel headers
ii  linux-image-5.4.0-70-generic            5.4.0-70.78          amd64        Signed kernel image generic
ii  linux-image-5.4.0-71-generic            5.4.0-71.79          amd64        Signed kernel image generic
ii  linux-image-5.4.0-72-generic            5.4.0-72.80          amd64        Signed kernel image generic
ii  linux-image-generic                     5.4.0.72.75          amd64        Generic Linux kernel image
ii  linux-libc-dev:amd64                    5.4.0-72.80          amd64        Linux Kernel Headers for development
ii  linux-modules-5.4.0-70-generic          5.4.0-70.78          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-5.4.0-71-generic          5.4.0-71.79          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-5.4.0-72-generic          5.4.0-72.80          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.4.0-70-generic    5.4.0-70.78          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.4.0-71-generic    5.4.0-71.79          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.4.0-72-generic    5.4.0-72.80          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-signed-generic                    4.15.0.129.116       amd64        Complete Signed Generic Linux kernel and headers (dummy transitional package)
ii  linux-signed-generic-lts-utopic         4.4.0.131.137        amd64        Complete Signed Generic Linux kernel and headers (dummy transitional package)
ii  linux-sound-base                        1.0.25+dfsg-0ubuntu5 all          base package for ALSA and OSS sound systems

$ uname -r 5.4.0-70-generic

membersound
  • 1,410
  • Could re recheck the last command? Apart from that, the prior commands worked so far. – membersound Apr 21 '21 at 09:04
  • uff need more cofffein sudo apt purge $(dpkg -l | egrep '^rc' | awk '{print $2}') or with sudo dpkg -P $(dpkg -l | egrep '^rc' | awk '{print $2}') – nobody Apr 21 '21 at 09:09

1 Answers1

1

Most of what is in /boot are the kernels, you can try and remove old kernels and kernel-headers manually. Be sure to read the post first and ask any questions you have, deleting the wrong kernel will leave your system un-bootable.

First check which linux-headers and linux-images are installed dpkg -l "linux*" |grep "ii"

You should not remove your current kernel, it is recommend to keep your current and previous kernel, the rest may be removed with;

apt-get remove <kernel_package_name>

Be sure to double check the packages that will be removed and in case of doubt, ask before proceeding.

DK88
  • 56
  • Please have a look at my update. I wonder: my current kernel is 5.4.0-70-generic, but I have lots of kernels on disk with newer version. Should I now remove the newer kernels? Or should I better upgrade to the newer kernel. But why does apt get upgrade not automatically upgrade to the newest kernel? – membersound Apr 21 '21 at 09:16
  • If you reboot, can you choose to boot on the newest installed kernel (5.4.0-72) ? – Soren A Apr 21 '21 at 09:25
  • No, there is not choose screen or similar. It automatically boots to this version. – membersound Apr 21 '21 at 09:26
  • To enter GRUN menu: With BIOS, quickly press and hold the Shift key, which will bring up the GNU GRUB menu. (If you see the Ubuntu logo, you've missed the point where you can enter the GRUB menu.) With UEFI press (perhaps several times) the Escape key to get grub menu. – Soren A Apr 21 '21 at 09:31
  • sounds to me like the Grub config needs to be updated, normally this should be part of the new kernel instalation process. The error you are getting is a catch 22; ** update-initramfs: Generating /boot/initrd.img-5.4.0-72-generic Error 24 : Write error : cannot write compressed block **

    it is trying to update the Grub configuration to include the new kernel. Could you post the output of ** df -h **.

    I think there are 2 options; 1 enlarge /boot, this is probably a partition making this somewhat troublesome. 2 delete intermediate kernels, keep the current and latest kernel.

    – DK88 Apr 22 '21 at 09:52
  • Formatting is a pain with this editor If you manage to remove some of the kernels the problem will probably solve it self, it should reconfigure grub after succesfully running the install/removal scrip, if not here is an explanation on how to manually Update Grub. – DK88 Apr 22 '21 at 10:07