How to fix E: Not enough free disk space. The upgrade has aborted in APT
This error occurs when your system doesn't have sufficient free disk space to complete an APT package upgrade or installation. The upgrade process needs temporary space for package files, and when the disk is full, the operation fails and is aborted.
Quick fix
Fixes E: Not enough free disk space. The upgrade has aborted
sudo apt-get clean- Check current disk space usage
- Clean the APT package cache
- Remove old kernel images
- Clean up log files
sudo apt-get cleanE: Not enough free disk space. The upgrade has aborted
What this error means
APT (Advanced Package Tool) needs temporary disk space to download and install package files before completing the upgrade. This error indicates that your system lacks the required free space. The issue commonly occurs in the /boot, /var, or / (root) partitions, where APT stores downloaded .deb files in /var/cache/apt/archives/ and unpacks them during installation. When any of these partitions reaches capacity, the upgrade process halts to prevent further system issues.
Typical symptoms
- APT upgrade or installation command fails with 'Not enough free disk space' error
- The upgrade process starts but stops partway through
- You receive a message like 'The upgrade needs a total of X MB free space'
- System becomes unresponsive or unstable after running out of disk space
- Error appears during do-release-upgrade or apt-get dist-upgrade commands
Common causes
- Old kernel images and headers accumulating in /boot partition
- Large log files in /var/log taking up space without being rotated
- APT cache in /var/cache/apt/archives/ containing old downloaded .deb files
- Temporary files in /var/tmp or /tmp remaining after interrupted installations
- Docker images, containers, or volumes consuming disk space (common in development systems)
- System logs from journalctl accumulating without cleanup
- /boot partition being too small relative to the number of installed kernels
How to fix "E: Not enough free disk space. The upgrade has aborted"
Run df -h to see which partitions are full. Pay special attention to /boot, /var, and / (root). You can also use sudo du -h --max-depth=1 /var | sort -h | tail -n 10 to identify the largest directories consuming space.
Remove cached .deb files that are no longer needed:
sudo apt-get cleanFor a more aggressive cleanup that also removes partial package files:
sudo apt-get autocleanThis typically frees up several hundred MB to several GB, depending on your system history.
Old kernel versions consume significant space in /boot. Remove them with:
sudo apt-get autoremoveFor a more thorough cleanup with headers:
sudo apt-get autoremove --purgeIf autoremove doesn't remove enough, you can manually purge specific old kernels:
sudo apt-get purge linux-headers-X.X.X-XX-generic linux-image-X.X.X-XX-genericReplace X.X.X-XX with the kernel version you want to remove (use uname -r to see your current kernel).
Large log files in /var/log can consume significant disk space. Check which logs are large:
ls -lhS /var/log | head -20If journalctl is using excessive space, trim it:
sudo journalctl --vacuum-size=64MYou can also rotate or delete individual large log files:
sudo truncate -s 0 /var/log/syslogBeyond kernels, remove other unused packages:
sudo apt-get autoremove --purgeYou can also check for config files from removed packages:
sudo dpkg --list | grep '^rc' | awk '{print $2}' | xargs sudo apt-get remove --purgeCheck disk usage again:
df -hEnsure you have at least 5-10% free space on all partitions, especially /boot (which should have at least 500MB free). For a safe upgrade, aim for at least 20% free space.
Once you've freed up sufficient space, retry the upgrade:
sudo apt-get update
sudo apt-get upgradeOr for a full distribution upgrade:
sudo do-release-upgradeAdvanced notes
If you have a /boot partition that's persistently too small, consider adjusting initramfs compression. By default, /boot uses lz4 compression which has a poor compression ratio. You can achieve better compression by editing /etc/initramfs-tools/initramfs.conf and setting COMPRESS=xz instead of the default. This significantly reduces initramfs size at the cost of slightly longer boot times. After editing, run sudo update-initramfs -u to apply the change.
For systems using LVM (Logical Volume Manager), you can expand the /var partition without reinstalling:
sudo lvextend -L +10G /dev/mapper/vg0-var
sudo resize2fs /dev/mapper/vg0-varReplace vg0-var with your actual LVM volume name (check with sudo lvs). If you're not using LVM and /var is on a separate partition, you may need to use tools like GParted or resize your disk and partition table manually.
Virtual machine users can expand the virtual disk in their hypervisor (VMware, VirtualBox, etc.), then resize partitions within the guest OS using similar LVM or GParted techniques.
Frequently asked questions
- What does "E: Not enough free disk space. The upgrade has aborted" mean?
- APT (Advanced Package Tool) needs temporary disk space to download and install package files before completing the upgrade. This error indicates that your system lacks the required free space. deb files in /var/cache/apt/archives/ and unpacks them during installation.
- How do I fix "E: Not enough free disk space. The upgrade has aborted"?
- This error occurs when your system doesn't have sufficient free disk space to complete an APT package upgrade or installation. The upgrade process needs temporary space for package files, and when the disk is full, the operation fails and is aborted.
- What causes "E: Not enough free disk space. The upgrade has aborted"?
- Old kernel images and headers accumulating in /boot partition Large log files in /var/log taking up space without being rotated APT cache in /var/cache/apt/archives/ containing old downloaded .deb files
- Is the "E: Not enough free disk space. The upgrade has aborted" 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
- ๐APT Official Documentation
- ๐
- ๐
- ๐