The update-initramfs command failed while trying to generate a new initial RAM filesystem. This typically occurs due to insufficient disk space in the /boot partition or missing kernel modules.
The `update-initramfs` tool is responsible for creating and updating the initramfs (initial RAM filesystem) for your Linux kernel. This image contains essential drivers and modules needed to boot your system. Exit code 1 indicates a generic failure, most commonly caused by a full /boot partition that doesn't have enough space to write the new initrd.img file.
First, verify that the /boot partition actually has space issues:
df -h /bootIf /boot shows 100% or very high usage (>90%), this is your problem. The initramfs generator needs temporary space to create the new image before moving it into place.
Use apt's automatic removal tool to safely remove obsolete kernel packages:
sudo apt autoremove --purgeThis command removes old kernel images and headers that are no longer needed, typically freeing 100-500MB. Verify the cleanup worked:
df -h /bootIf you need more aggressive cleanup, manually list and remove specific old kernels:
dpkg --list | grep linux-image
sudo apt remove linux-image-5.4.0-42-generic # Replace with actual old versionImportant: Never remove the kernel version you're currently running. Check your current version with uname -r.
If autoremove didn't free enough space, you can manually delete old initrd.img files:
ls -la /boot/initrd*
sudo rm /boot/initrd.img-5.4.0-42-generic # Only remove OLD versionsEach initrd.img file is typically 30-50MB. Make sure you keep the one for your current kernel (check with uname -r).
Once you have freed space, try updating the initramfs again:
sudo update-initramfs -uFor a specific kernel version:
sudo update-initramfs -u -k 5.15.0-56-genericFor all kernels:
sudo update-initramfs -u -k allWatch for the success message confirming the initramfs was created.
If the error persists after freeing space, there may be broken package dependencies:
sudo apt install -f
sudo dpkg --configure -aThese commands fix broken package installations and reconfigure packages that may have been interrupted. Then retry the update-initramfs command.
As a last resort, force a complete recreation of the initramfs for your current kernel:
sudo update-initramfs -c -k $(uname -r)The -c flag creates a new initramfs from scratch rather than updating an existing one. This bypasses some corruption issues.
Plymouth Font Issues: Some systems fail due to missing Plymouth boot splash fonts. If errors mention 'fonts-ubuntu' or 'DejaVuSansMono', reinstall with: sudo apt install --reinstall fonts-ubuntu followed by sudo update-initramfs -u.
Third-Party Hook Failures: Errors like 'hooks/ntfs_3g failed with return 1' indicate a broken hook from an installed tool. Temporarily disable with: sudo chmod -x /usr/share/initramfs-tools/hooks/ntfs_3g then run sudo apt install -f and sudo update-initramfs -u. Re-enable with sudo chmod +x after fixing.
Boot Partition Size: If /boot repeatedly fills up, consider resizing it. A typical /boot partition should be at least 500MB-1GB. Use tools like GParted in a live environment to resize if needed.
Recovery Mode: If your system becomes unbootable after a failed kernel update, boot into Recovery Mode from the GRUB menu and run these commands to repair.
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Sub-process /usr/bin/dpkg returned an error code (2)
How to fix "Sub-process /usr/bin/dpkg returned an error code (2)" in APT
dpkg-divert: error: rename involves overwriting 'path' with different file
How to fix dpkg-divert rename conflicts in APT
E: Sub-process /usr/bin/dpkg returned an error code (1) during kernel installation
How to fix "dpkg returned an error code (1)" in APT kernel installation
dpkg: dependency problems prevent configuration of triggers
dpkg: dependency problems prevent configuration of triggers in apt