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) ...
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:

Anyone got any ideas as to what I can do?


12 Answers 12


Running auto-remove and clean worked for my situation.

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

  • this did it for me Nov 26, 2019 at 12:57
  • Thanks, you saved me a few hours of headache trying to reinstall the old version of Nvidia drivers to restore my display setup
    – Moha
    Oct 16, 2020 at 18:01
  • 1
    This worked for me as well. I suspect, but can't confirm that I had older initrd images in /boot and it was full. I know that /boot for me was nearly full and I ignored the problem. Now it's 55% usage so that's my guess.
    – Kevin
    Mar 22 at 21:37

Warning: do not do this if your hard drive is encrypted unless you know exactly what you're doing

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

I just did:

sudo apt remove initramfs-tools
sudo apt clean
sudo 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.

  • 1
    This one works for me Jun 7, 2021 at 7:21
  • This works for me too. thx
    – nthack
    Jul 31, 2021 at 22:34
  • 2
    Be careful when running these commands if using full-disk encryption. This can potentially nuke cryptsetup and leave the system unbootable (happened to me). Jan 13 at 16:17
  • @JamesHibbard that's a good point, I hadn't thought of mentioning the danger of using on encrypted drive, as I don't use it. Jan 13 at 21:55

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.

  • 2
    This is fantastic! I tried the other solutions, but none of them made a difference. This was exactly my problem. I have /boot on a different partition on a USB drive with encryption. For me, your solution didn't actually work, but the explanation gave me what I needed: cd /boot and rm all the old versions of what was in there, then sudo apt update (Adding an answer specific for this for visibility) Jun 26, 2020 at 2:29
  • fundamentally this sounds like what I need (perform operation where I have space, then copy results), as I have a 260mb partition 1 that gets filled up and errors out. but this doesn't seem to work... can't do it on usb boot, as it is read-only fs, so update-initramfs throws errors. when doing it in chroot env, -b . doesn't seem to do anything, though... same error.
    – Kyle Baker
    Dec 5, 2021 at 7:56

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


A similar question has this solution:

sudo apt-get autoclean
sudo apt-get clean
sudo apt-get update 
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get -f install
sudo dpkg --configure -a

Additionally ensure this command:

ll /usr/share/initramfs-tools/hooks/fsck

returns this output:

-rwxr-xr-x 1 root root 2468 Sep 18  2018 /usr/share/initramfs-tools/hooks/fsck*
  • Thanks for your reply, done all that and the problem persists sudo dpkg --configure -a .. 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): Errors ..processing: linux-image-4.15.0-47-generic initramfs-tools linux-image-4.15.0-48-generic the ll command returns the expected output.
    – adieb
    Apr 25, 2019 at 8:23
  • I also did sudo apt autoremove Dec 8, 2019 at 11:23
sudo apt remove initramfs-tools
sudo apt clean
sudo apt install initramfs-tools
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get update 
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get -f install
sudo dpkg --configure -a

This was the solution for me.

  • The first line (sudo apt remove initramfs-tools) helped me; none of the others did. Sep 30, 2021 at 5:23
  • 1
    (-1) this removes cryptsetup which if you have your disk encrypted (like me) will not allow you to boot into your system. Do NOT do this
    – pzivich
    Oct 18, 2021 at 12:34
  • i often get this error if i use some of this:
    – SL5net
    Feb 8 at 16:22

I've just had a very similar issue when I did an sudo apt autoremove and it failed attempting to install kernel files for a kernel I don't have. My uname -a shows I'm using kernel version 5.0.0-20 and running ls -al /boot shows only this and the 5.0.0-17 kernel are installed. However, apt suddenly turned up errors and attempted to install files in my /boot for old kernels including 5.0.0-15, 4.18.0-17, 4.13.0-45. Which is weird.

So I figure that somehow they've altered the logic for dkms (or something related to initramfs) and it checks some other locations to see if kernels might be installed and then does updates on those kernels and replaces missing files.

I'm not sure exactly what fixed it but I did:

sudo apt purge *5.0.0-15* *4.18.0-17* *4.13.0-45* 
#check carefully that it's not removing anything you need though, this is a hammer to crack a nut

ls -al /lib/modules 
# which revealed lots of old module folders that I removed with ...
sudo rm -rf /lib/modules/4.* 
# and similarly for the 5.0.0-15 modules

Then I did:

ls -al /usr/src/ 
# which again showed old source trees that I pruned with
sudo rm -rf sudo rm -rf /usr/src/linux-headers-4.*

Then I did:

locate -e 4.13.0 
# which found old kernel files in
ls -al /var/lib/initramfs-tools/ 
# so I removed with
sudo rm -rf /var/lib/initramfs-tools/4*

I have problems with a very tight /boot folder for historical reasons and so removed old kernel files with:

sudo rm -i /boot/**4* 
# and similar for all but my current and next oldest kernels
# -i is interactive mode so you have to answer 'y' to remove
# that's a really useful safety check, 'sudo rm' is a dangerous tool!

Finally I ran:

sudo apt -f install

Which finished as expected and returned the system to the expected state without attempting to install extraneous kernels. I did not test as I went along so can not guarantee which part fixed it, but it was not harmful to clear those old files out AFAICT.

Aside, checking my /var/log/apt/history.log file, this appears to be the beginning of this particular error:

Start-Date: 2019-07-01  17:59:10
Commandline: /usr/bin/unattended-upgrade
Upgrade: linux-tools-common:amd64 (4.15.0-52.56, 4.15.0-54.58)
End-Date: 2019-07-01  17:59:16

Start-Date: 2019-07-01  17:59:22
Commandline: /usr/bin/unattended-upgrade
Install: linux-image-5.0.0-20-generic:amd64 (5.0.0-20.21~18.04.1, automatic), linux-modules-extra-5.0.0-20-generic:amd64 (5.0.0-20.21~18.04.1, automatic), linux-modules-5.0.0-20-generic:amd64 (5.0.0-20.21~18.04.1, automatic)
Upgrade: linux-image-generic-hwe-18.04-edge:amd64 (,, linux-image-extra-virtual-hwe-18.04-edge:amd64 (,
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2019-07-01  18:00:10

But this may be a false flag as for me the limited /boot space can be the cause of the error code (1).


I had this issue on two separate machines today after doing an apt update and apt upgrade except mine was for linux-image-4.15.0-48-generic. (Ubuntu 18.04.2)

My fix was this (reproduced on both machines):

sudo rm /var/lib/dpkg/info/linux-image-4.15.0-48-generic.postinst
sudo dpkg --configure -a
sudo apt-get update

Then reinstall the package:

sudo apt install linux-image-4.15.0-48-generic

This will set the package to manually installed and will replace the *.postinst file.


Try purging unused kernels. If problem persists then remove all 'initrd' images with

sudo rm /boot/initrd.img*

then generate new 'initrd' images for all current existing kernels

sudo update-initramfs -c -k all

This was happening to me. Ended up being that /boot was full.

Check boot partition space with df -h

Then free up some space with: How do I free up more space in /boot?


I followed all the advice here and nothing worked. I fixed it by making sure that the boot/efi partition was mounted, which in my case it wasn't. /etc/fstab was not configured correctly due to the partuuid/uuid/lable not matching. Then I updated and upgraded with no errors, followed by updating grub and a reboot.


I had this problem too. My /boot partition was full. So, I was getting errors of initframs compilation when trying to run apt-update. My solution was to remove old kernels in order to free up space, following the steps from Lekensteyn in: How do I free up more space in /boot?

This will list all the kernel images and headers currently installed:

~ % kernelver=$(uname -r | sed -r 's/-[a-z]+//')
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver


You can purge the older linux-headers and linux-image packages by using apt-get purge with care (remember, not to delete the packages associated to the kernel you are using), for instance:

sudo apt-get purge linux-image-5.4.0-94 linux-image-5.4.0-96 linux-headers-5.4.0-94 linux-headers-5.4.0-96

This should take care also of the matching generic packages.

Afterwards, I ran

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

and the errors were fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.