How to fix E: Not enough free disk space. The upgrade has aborted in APT

APTINTERMEDIATEHIGHUpdated May 14, 2026ยท 196 views

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
  1. Check current disk space usage
  2. Clean the APT package cache
  3. Remove old kernel images
  4. Clean up log files
apt โ€” error
sudo apt-get clean
E: 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

  1. Old kernel images and headers accumulating in /boot partition
  2. Large log files in /var/log taking up space without being rotated
  3. APT cache in /var/cache/apt/archives/ containing old downloaded .deb files
  4. Temporary files in /var/tmp or /tmp remaining after interrupted installations
  5. Docker images, containers, or volumes consuming disk space (common in development systems)
  6. System logs from journalctl accumulating without cleanup
  7. /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"

1Check current disk space usage

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.

2Clean the APT package cache

Remove cached .deb files that are no longer needed:

bash
sudo apt-get clean

For a more aggressive cleanup that also removes partial package files:

bash
sudo apt-get autoclean

This typically frees up several hundred MB to several GB, depending on your system history.

3Remove old kernel images

Old kernel versions consume significant space in /boot. Remove them with:

bash
sudo apt-get autoremove

For a more thorough cleanup with headers:

bash
sudo apt-get autoremove --purge

If autoremove doesn't remove enough, you can manually purge specific old kernels:

bash
sudo apt-get purge linux-headers-X.X.X-XX-generic linux-image-X.X.X-XX-generic

Replace X.X.X-XX with the kernel version you want to remove (use uname -r to see your current kernel).

4Clean up log files

Large log files in /var/log can consume significant disk space. Check which logs are large:

bash
ls -lhS /var/log | head -20

If journalctl is using excessive space, trim it:

bash
sudo journalctl --vacuum-size=64M

You can also rotate or delete individual large log files:

bash
sudo truncate -s 0 /var/log/syslog
5Remove unused packages and dependencies

Beyond kernels, remove other unused packages:

bash
sudo apt-get autoremove --purge

You can also check for config files from removed packages:

bash
sudo dpkg --list | grep '^rc' | awk '{print $2}' | xargs sudo apt-get remove --purge
6Verify sufficient space is available

Check disk usage again:

bash
df -h

Ensure 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.

7Retry the upgrade

Once you've freed up sufficient space, retry the upgrade:

bash
sudo apt-get update
sudo apt-get upgrade

Or for a full distribution upgrade:

bash
sudo do-release-upgrade

Advanced 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:

bash
sudo lvextend -L +10G /dev/mapper/vg0-var
sudo resize2fs /dev/mapper/vg0-var

Replace 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