The dpkg post-installation script for linux-image failed with exit status 1, typically due to a full /boot partition, incompatible kernel modules, or corrupted package metadata. This can be fixed by freeing space, removing old kernels, or reconfiguring dpkg.
When you install or update a Linux kernel on Debian-based systems (Ubuntu, Linux Mint, Debian), the linux-image package includes a post-installation script that sets up the kernel, generates initramfs images, and installs DKMS modules. If this script fails with exit status 1, it means the kernel installation process encountered an error that prevented it from completing successfully. The most common cause is insufficient space in the /boot partition, but it can also result from incompatible or missing kernel modules (DKMS modules like wireguard or displaylink), corrupted package metadata, or interrupted installations.
First, verify whether you have sufficient space in your /boot directory. A full /boot partition is the most common cause of this error.
df -h /bootIf the output shows less than 100 MB free, proceed to step 2 to remove old kernels. If you have adequate space, skip to step 3.
List all installed kernels on your system:
dpkg --list | grep linux-imageIdentify old kernel versions you no longer need (usually keep only the 2 most recent). Remove them with:
sudo apt-get purge linux-image-X.X.X-XX-genericReplace X.X.X-XX-generic with the actual version number. Repeat for each old kernel. After removing old kernels, verify you've freed space:
df -h /bootOnce you've freed space, use dpkg to retry configuring packages that failed:
sudo dpkg --configure -aThis tells dpkg to configure all packages that are currently installed but not yet fully configured. If this succeeds, the post-installation script will complete.
If the reconfigure step doesn't resolve the issue, try fixing broken package dependencies:
sudo apt --fix-broken installOr the older syntax:
sudo apt-get install -fThis will attempt to resolve any missing dependencies or broken package installations.
If the above steps don't work, incompatible DKMS modules may be blocking installation. Check for DKMS errors in the output from step 3. Common problematic modules include:
- wireguard: No longer needed in kernels 5.x+
- evdi (DisplayLink): May not support newer kernel versions
- virtualbox-guest-additions: Version mismatch with kernel
For wireguard:
sudo apt purge wireguard-dkmsFor evdi/DisplayLink, check the Debian/Ubuntu repositories for a version compatible with your kernel version.
After removing the problematic package, retry:
sudo dpkg --configure -aOnce dpkg finishes, manually update the initramfs to ensure the kernel is fully configured:
sudo update-initramfs -u -k allThen, verify the kernel installation completed successfully:
sudo apt update
sudo apt install --fix-brokenDKMS Modules: The linux-image post-installation script automatically compiles DKMS modules for your specific kernel. If a module is incompatible or its source is missing, the entire post-installation will fail. Check /var/lib/dkms and module logs for details.
Firmware Packages: On some systems, linux-firmware package corruption can also cause post-installation script failures. If you see "linux-firmware (--configure): package is in a very bad inconsistent state", reinstall it: sudo apt install --reinstall linux-firmware
SELinux/AppArmor: On systems with SELinux enabled, permission issues during kernel installation can also cause failures. Check dmesg for AppArmor denials.
Rootless Systems: On rootless Docker or certain container environments, kernel modules cannot be installed. The error is expected and harmless in these cases.
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