The /boot partition is full and cannot install new kernel updates. This occurs when old kernel versions accumulate and consume all available space. Free up space by removing old unused kernels.
This error occurs when your /boot partition (which stores kernel images, initramfs files, and bootloader data) has reached 100% capacity. Most Linux systems allocate a separate /boot partition with limited space—typically only enough for 3-5 kernel versions. When kernel updates accumulate without old versions being removed, the partition fills up and prevents new kernel installations. This is a common issue on systems that haven't been maintained or have automatic updates enabled without cleanup policies.
Check the current space usage of the /boot partition:
df -h /bootIf the 'Use%' column shows 100%, the partition is indeed full.
Find the kernel version you are currently running (do not remove this one):
uname -rExample output: 5.15.0-91-generic. This is the kernel you must keep.
View all installed kernel packages:
dpkg -l | grep linux-imageThis shows all kernel versions. Identify old ones (lower version numbers) that differ from your current running kernel.
Remove old kernel packages one at a time. Replace VERSION-NUMBER with the kernel version you want to remove:
sudo apt remove --purge linux-image-VERSION-NUMBER-generic
sudo apt remove --purge linux-image-unsigned-VERSION-NUMBER-genericExample:
sudo apt remove --purge linux-image-5.13.0-44-generic
sudo apt remove --purge linux-image-unsigned-5.13.0-44-genericRemove the 2-3 oldest kernels, keeping at least one older kernel as a backup in case the current kernel has issues.
After removing old kernels, run autoremove to clean up related dependencies:
sudo apt autoremove --purgeThen update the bootloader configuration:
sudo update-grubConfirm that /boot partition now has free space:
df -h /bootYou should see the 'Use%' below 80%. You can now proceed with kernel updates.
If the partition is so full that apt cannot run, use dpkg directly:
sudo dpkg --configure -a
sudo dpkg --purge $(dpkg -l | grep linux-image | awk '{print $2}' | grep -v $(uname -r | sed 's/-[a-z]*$//'))
sudo apt-get -f installThis forcefully removes old kernel packages without relying on apt's dependency resolution.
Prevention: To prevent this issue, keep only 2-3 recent kernels. Add to /etc/apt/apt.conf.d/50unattended-upgrades (if using unattended-upgrades):
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";Alternatively, reduce initramfs compression overhead by enabling xz compression in /etc/initramfs-tools/initramfs.conf:
COMPRESS=xzThen rebuild:
sudo update-initramfs -u -k allLong-term: If /boot is frequently full, consider resizing the partition to 1GB using gparted or similar tools. Most modern systems should have 500MB-1GB for /boot to safely hold 4-5 kernel versions.
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