How to fix run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 in APT

APTINTERMEDIATEHIGHUpdated Sep 13, 2026· 232 views

The "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1" error occurs during kernel updates when the initramfs-tools script fails. Common causes include insufficient disk space in /boot, corrupted packages, or missing dependencies. Most fixes involve regenerating the initramfs or freeing disk space.

Quick fix

Fixes run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1

df -h /boot
  1. Check available disk space in /boot
  2. Remove old kernel images to free space (if needed)
  3. Fix broken package configuration
  4. Reinstall initramfs-tools package
apt — error
df -h /boot
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1

What this error means

This error happens during the post-installation phase of a kernel update on Debian/Ubuntu systems. The `run-parts` command executes scripts in the `/etc/kernel/postinst.d/` directory to set up the new kernel. When the `initramfs-tools` script (which generates the kernel's initial ramdisk) exits with a non-zero code, the entire kernel installation fails. The initramfs contains essential kernel modules and drivers needed to boot the system. When the script fails to generate it, your system cannot complete the kernel update, leaving you with an incomplete installation.

Typical symptoms

  • Kernel update fails with 'exit code 1' message
  • System boots but new kernel version doesn't install
  • apt commands show package configuration errors after kernel install attempt
  • /boot partition shows as full or running out of space

Common causes

  1. Insufficient disk space in the /boot partition (most common)
  2. Corrupted initramfs-tools package or conflicting packages
  3. Missing or broken dependencies required by initramfs-tools
  4. Failing hook scripts in /usr/share/initramfs-tools/hooks/
  5. SELinux or AppArmor restrictions preventing script execution

How to fix "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1"

1Check available disk space in /boot

First, verify if /boot has enough free space. The initramfs images can be quite large.

bash
df -h /boot

If /boot is nearly full (90%+ used), you need to free up space before retrying the kernel update. Typical requirement is at least 50-100MB free space.

2Remove old kernel images to free space (if needed)

If /boot is full, remove old kernel versions that are no longer needed:

bash
sudo apt autoremove --purge

This command removes old kernel packages automatically. You can also manually purge specific old kernels:

bash
sudo apt purge linux-image-X.X.X-XX-generic linux-headers-X.X.X-XX-generic

Replace X.X.X-XX with the actual kernel version number. Always keep at least one working kernel version.

3Fix broken package configuration

Attempt to configure any broken packages and fix broken dependencies:

bash
sudo dpkg --configure -a
sudo apt --fix-broken install

These commands will try to complete any pending package installations or repairs. Run them sequentially.

4Reinstall initramfs-tools package

The initramfs-tools package itself may be corrupted. Reinstall it:

bash
sudo apt install --reinstall initramfs-tools initramfs-tools-core

This will restore the package from the repository and re-run its post-installation scripts.

5Manually regenerate the initramfs

If the above steps don't work, manually regenerate the initramfs for your current kernel:

bash
sudo update-initramfs -u -k all

The -u flag updates existing initramfs images, and -k all applies to all kernels. This bypasses the post-installation hook and generates initramfs directly.

6Debug the exact failure (advanced)

If the above steps don't resolve the issue, run the script directly to see the specific error:

bash
sudo /etc/kernel/postinst.d/initramfs-tools $(uname -r) /boot/vmlinuz-$(uname -r)

This will show you the exact failure message. Check for errors related to:
- Missing tools (gzip, cpio, lz4)
- Hook script failures in /usr/share/initramfs-tools/hooks/
- File system permission issues

Review detailed logs:

bash
sudo journalctl -xe
dmesg | tail -50

Advanced notes

On systems with SELinux or AppArmor enabled, permission issues can prevent the postinst script from executing. Check your security module status with getenforce (SELinux) or aa-status (AppArmor) and temporarily disable if testing.

For Raspberry Pi systems running Debian, the error may involve raspi-firmware. If you see "raspi-firmware: missing /boot/firmware", remove the package with sudo apt autoremove --purge raspi-firmware.

If using dracut instead of initramfs-tools, ensure the /etc/kernel/postinst.d/initramfs-tools script is removed or the update-initramfs executable is available. These packages can conflict on some systems.

Frequently asked questions

What does "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return c" mean?
This error happens during the post-installation phase of a kernel update on Debian/Ubuntu systems. d/ directory to set up the new kernel. When the initramfs-tools script (which generates the kernel's initial ramdisk) exits with a non-zero code, the entire kernel installation fails.
How do I fix "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return c"?
The "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1" error occurs during kernel updates when the initramfs-tools script fails. Common causes include insufficient disk space in /boot, corrupted packages, or missing dependencies. Most fixes involve regenerating the initramfs or freeing disk space.
What causes "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return c"?
Insufficient disk space in the /boot partition (most common) Corrupted initramfs-tools package or conflicting packages Missing or broken dependencies required by initramfs-tools
Is the "run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return c" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading