3

When I try install something, it seems my cryptswap got a problem.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package meofetch
t@pop-os:~$ sudo apt-get remove neofetch
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  neofetch
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 339 kB disk space will be freed.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.136ubuntu6) ...
update-initramfs: deferring update (trigger activated)
(Reading database ... 358177 files and directories currently installed.)
Removing neofetch (7.0.0-1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for initramfs-tools (0.136ubuntu6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-7634-generic
cryptsetup: WARNING: Resume target cryptswap uses a key file
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-7634-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

2 Answers2

3

The error message that is reported in the question only occurs in 20.04. Here is a workaround.

  1. Boot into Recovery mode and wait until the loading of the cryptswapfile times out.

  2. Go to a root shell (the second entry from the bottom in the Recovery Menu) and comment out the following lines in /etc/fstab and /etc/crypttab by preceding each line with a # character.

    /etc/fstab :

     /dev/mapper/cryptswap none swap defaults 0 0  
    

    /etc/crypttab :

    cryptswap /cryptswapfile /dev/urandom swap,cipher=aes-xts-plain64,size=256    
    
  3. Run swapoff -a && update-initramfs -u.

  4. Uncomment the lines in fstab and crypttab that you commented out, and reboot with sudo reboot.

karel
  • 114,770
0

For people with similar message, but also talking about the RESUME variable that would be set to a wrong UUID:

Just remove the automatically set RESUME variable in resume file of initramfs-tools (sudo rm /etc/initramfs-tools/conf.d/resume), or update it to the correct UUID of your swap partition.