Failed to upgrade kubuntu 20

I try to upgrade my kubuntu 20, but got errors :

# uname -a
Linux master-laptop 5.11.0-36-generic #40~20.04.1-Ubuntu SMP Sat Sep 18 02:14:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
# sudo apt install -y libnotify-bin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libnotify-bin is already the newest version (0.7.9-1ubuntu2).
The following packages were automatically installed and are no longer required:
  appmenu-gtk-module-common libappmenu-gtk3-parser0 libllvm11 libnvidia-extra-470-server libreoffice-help-common
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 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.19) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-36-generic
W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/cml_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/icl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/ehl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/ehl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.5.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.5.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_49.0.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/dg1_dmc_ver2_02.bin for module i915
I: The initramfs will attempt to resume from /dev/sdb6
I: (UUID=28ee0d89-a0cc-45ab-bb0c-aeaee8072afa)
I: Set the RESUME variable to override this.
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.11.0-36-generic with 1.
dpkg: error processing package linux-firmware (--configure):
 installed linux-firmware package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-firmware
E: Sub-process /usr/bin/dpkg returned an error code (1)

How can I fix it ?

MODIFIED BLOCK : Trying to install libnotify-bin I upgraded with command before:

sudo apt-get update
sudo apt-get upgrade

where I got the error. No I have free space on my 2 disks:

# df -HT   
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  4,1G     0  4,1G   0% /dev
tmpfs          tmpfs     827M  2,2M  824M   1% /run
/dev/sdb2      ext4       53G   22G   28G  44% /
tmpfs          tmpfs     4,2G  147M  4,0G   4% /dev/shm
tmpfs          tmpfs     5,3M  4,1k  5,3M   1% /run/lock
tmpfs          tmpfs     4,2G     0  4,2G   0% /sys/fs/cgroup
/dev/sdb7      ext4       30G  8,7G   20G  31% /var
/dev/sdb1      ext4      339M  245M   69M  79% /boot
/dev/sdb8      fuseblk   399G  145G  254G  37% /mnt/_work_sdb8
/dev/loop1     squashfs  132k  132k     0 100% /snap/bare/5
/dev/loop2     squashfs  173M  173M     0 100% /snap/gnome-3-28-1804/161
/dev/loop3     squashfs  153M  153M     0 100% /snap/chromium/1772
/dev/loop0     squashfs  153M  153M     0 100% /snap/chromium/1781
/dev/loop4     squashfs   69M   69M     0 100% /snap/gtk-common-themes/1519
/dev/loop5     squashfs   35M   35M     0 100% /snap/snapd/13270
/dev/loop6     squashfs   59M   59M     0 100% /snap/core18/2128
/dev/loop7     squashfs   34M   34M     0 100% /snap/snapd/13170
/dev/loop8     squashfs   69M   69M     0 100% /snap/gtk-common-themes/1515
/dev/sda1      fuseblk    65G   58G  7,2G  89% /mnt/Win_sda1
/dev/sda6      fuseblk   237G  122G  115G  52% /mnt/Work_sda6
/dev/sda8      fuseblk   628G  616G   13G  99% /mnt/Media_sda8
overlay        overlay    30G  8,7G   20G  31% /var/lib/docker/overlay2/55667a09a0a4dd7b2652416891374801e4cad2593f4d847996867d433e21132f/merged
overlay        overlay    30G  8,7G   20G  31% /var/lib/docker/overlay2/3e5c557ffebafb4c6c721883c3aff9fb630e107ffef216446a2fa87ee0e0943a/merged
shm            tmpfs      68M     0   68M   0% /var/lib/docker/containers/62d72386e094430ae77cdc963349b25a6121286a499b7b496f669897d30da089/mounts/shm
shm            tmpfs      68M     0   68M   0% /var/lib/docker/containers/65e54b5a9cd763eca696c18145b491824d1af87e4c0126f5756668bf389a6c91/mounts/shm
tmpfs          tmpfs     827M   17k  827M   1% /run/user/1000
overlay        overlay    30G  8,7G   20G  31% /var/lib/docker/overlay2/ecdc1eb336c1f085454d79a0a2cc76ccf7ced27125695edc6a46d83d24020cb5/merged
shm            tmpfs      68M     0   68M   0% /var/lib/docker/containers/f397d33006364590ced34e0cc34eea66ee958d2a140ddee564f387594b14d55e/mounts/shm

I have disks attached :

# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb2 during installation
UUID=2c450ff1-cf7d-4449-a9e5-550a9f338eb8 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sdb1 during installation
UUID=85770d6f-d0c4-42f9-af2e-d261930d2c56 /boot           ext4    defaults        0       2
# /var was on /dev/sdb7 during installation
UUID=36ab8091-50e6-4022-8d5b-c79106b96bda /var            ext4    defaults        0       2
# swap was on /dev/sdb6 during installation
UUID=28ee0d89-a0cc-45ab-bb0c-aeaee8072afa none            swap    sw              0       0





/swapfile none swap defaults 0 0


# /dev/sdb2 /mnt/_windows_sdb2  ntfs-3g  defaults  0  0
/dev/sdb8 /mnt/_work_sdb8  ntfs-3g  defaults  0  0  # !
/dev/sdb7 /mnt/_linux2_sdb5 ext4 defaults 0 0

/dev/sda1 /mnt/Win_sda1  ntfs-3g  defaults  0  0
/dev/sda6 /mnt/Work_sda6  ntfs-3g  defaults  0  0   # !
/dev/sda8 /mnt/Media_sda8 ntfs-3g  defaults  0  0   # !
# /dev/sda3 /mnt/Old_linux_sda3 ntfs-3g  defaults  0  0  

Thanks in advance!


linux-firmware is the problematic package here because it is either not fully installed or corrupted.

Follow the below steps to fix this issue:

  1. Purge-reinstall the problematic packages:

    sudo dpkg -P linux-firmware --force-all
    sudo apt install --reinstall linux-firmware
    sudo apt -f install
    

    More likely this will work! But sometimes it returns the same error.

  2. In that case, you must manually delete it by running the following:

    sudo mv /var/lib/dpkg/info/linux-firmware* /tmp
    

    This will move all the components of the package you listed to the /tmp directory. You can later remove them if you want.

  3. Then run these commands to fix possible conflicts:

    sudo apt install aptitude
    sudo aptitude install linux-firmware
    sudo aptitude -f install
    sudo apt clean
    sudo apt autoremove
    sudo aptitude update 
    sudo aptitude upgrade -y
    

Feel free to ask me any questions in the comments.
Good Luck!