The dpkg package manager encountered full disk space during installation cleanup. Free up disk space by removing old package caches, then retry the installation.
This error occurs when the APT/dpkg package manager attempts to clean up temporary installation files but runs out of storage space. The system has insufficient disk space (typically on the root partition or /var partition where APT stores cache) to complete the package installation or upgrade. This commonly happens on systems with small root partitions or after repeated kernel updates that accumulate archived .deb files.
First, determine how much space is available on your root partition:
df -h /Look for the "Use%" column. If it shows 100% or very close (95%+), you need to free space immediately. Also check:
df -h /var
du -sh /var/cache/apt/archivesThis shows how much space the APT cache is consuming.
Remove all cached .deb files (both used and unused packages):
sudo apt-get cleanThis is safe and removes all archived packages from /var/cache/apt/archives. It does not uninstall anything.
For a more aggressive clean of just unused packages:
sudo apt-get autocleanThen verify space was freed:
df -h /If cleaning the APT cache wasn't enough, remove old kernel images:
First, see which kernels are installed:
dpkg -l 'linux-*' | grep '^ii'Then remove old kernels (keep the currently running one):
uname -r # Shows your current kernel versionRemove kernels older than your current one:
sudo apt-get remove --purge linux-image-[old-version]-genericReplace [old-version] with the specific kernel version. Repeat for multiple old kernels.
Then clean again:
sudo apt-get autoclean
sudo apt-get autoremove --purgeIf /boot is the full partition, it likely contains multiple kernel images:
df -h /bootRemove old kernel files from /boot:
sudo apt-get autoremove --purge
sudo apt-get autocleanIf /boot is still full after removing kernels via apt, you may need to manually clean:
ls -lh /bootDo not manually delete files in /boot unless absolutely necessary. Prefer using apt.
Once you've freed enough space (aim for at least 500MB-1GB free), retry your package operation:
sudo apt-get install [package-name]
# or
sudo apt-get upgradeMonitor disk usage during installation:
df -h / # Check in another terminalSELinux or AppArmor may interfere with dpkg cleanup on some systems. If the issue persists after freeing space, check security policy violations with sudo journalctl -xe.
On systemd systems, journal logs can consume significant space. Clean them with:
sudo journalctl --vacuum=50M # Keep only 50MB of logsFor permanent prevention, allocate at least 50GB for the root filesystem on new installs, especially if frequent package updates are expected. Use LVM if possible to dynamically expand partitions without reinstalling.
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