initramfs error when installing / updating

I've been having an error when updating or running any apt command for a week or so. Upgrading to LTS 18.04 hasn't resolved it, nor has removing all old kernels. Space isn't an issue either.

Attempting to reinstall initramfs doesn't work. Error I get is:

   Reading package lists...
Building dependency tree...
Reading state information...
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-47-generic (4.15.0-47.50) ...
Setting up initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for linux-image-4.15.0-47-generic (4.15.0-47.50) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-47-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.15.0-47-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.15.0-47-generic (--configure):
 installed linux-image-4.15.0-47-generic package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-47-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.15.0-47-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:
 linux-image-4.15.0-47-generic
 initramfs-tools

Anyone got any ideas as to what I can do?

Thanks.


Running auto-remove and clean worked for my situation.

apt-get auto-remove && apt-get clean && apt-get update && apt-get upgrade


For me, it was an issue with the initramfs-tools package

I just did:

# apt remove initramfs-tools

# apt clean

# apt install initramfs-tools

Then I no longer received the error

@jameshibbard brought up an important point: if you use either full-drive encryption, or encrypt your initramfs output (squashfs vmlinuz pacakges in /boot) as is a new feature, please be careful as switching out versions of your initramfs-tools seem likely to make your system unbootable.

If you have no idea what that means, chances are your system is not encrypted, unless you remember selecting it during the install process. I've noticed some graphical installers are including it as an option these days, including Ubuntu if I'm remembering correctly.

Do your due diligence.


I had this error since more than a year. Now I found a solution.

cd ~
mkdir initramfs
cd initramfs
cp -r /boot .
cd boot
sudo update-initramfs -ut -b .
sudo cp -r * /boot
sudo apt-get autoremove

Explanation: /boot is on a different partition with insufficient space to perform the operation. Solution: do the update on a drive where there is sufficient space and copy back the results.


As pointed out by Harald, the problem was insufficient space on the /boot partition.

His solution didn't work for me, but led me directly to what did:

cd /boot, then ls to look at the versions of the files already there. Then rm each of the files that have multiple versions, making sure to delete all but the newest, then sudo apt update