How to fix E: You don't have enough free space in /var/cache/apt/archives/ in APT

APTINTERMEDIATEMEDIUMUpdated Dec 29, 2025ยท 367 views

This error occurs when the APT package manager runs out of disk space while downloading packages. Clear the cache and reclaim storage from unused dependencies and applications.

Quick fix

Fixes E: You don't have enough free space in /var/cache/apt/archives/

sudo apt-get clean
sudo apt-get autoclean
  1. Clean up the APT cache
  2. Remove unused dependencies
  3. Check disk usage and identify space hogs
  4. Remove large unnecessary applications
apt โ€” error
sudo apt-get clean
sudo apt-get autoclean
E: You don't have enough free space in /var/cache/apt/archives/

What this error means

APT (Advanced Package Tool) caches downloaded package files in /var/cache/apt/archives/ to avoid re-downloading them during future installations. When this directory or the root partition runs out of space, APT cannot proceed with updates or installations. This typically happens on systems with limited storage, such as Raspberry Pi devices, containerized environments, or machines with multiple large applications installed.

Typical symptoms

  • apt install or apt upgrade fails with E: You don't have enough free space
  • System updates cannot complete
  • Installation of new packages fails mid-process
  • Error occurs even when running a single package installation

Common causes

  1. The /var/cache/apt/archives directory contains cached .deb files from previous installations that have accumulated over time
  2. The root partition is full or nearly full from other applications and system files
  3. Large applications like Docker, virtual machines, or databases are consuming significant disk space
  4. System log files in /var/log have grown very large without rotation
  5. Orphaned dependencies and unused packages remain installed on the system

How to fix "E: You don't have enough free space in /var/cache/apt/archives/"

1Clean up the APT cache

Run these commands to remove cached package files:

bash
sudo apt-get clean
sudo apt-get autoclean

- apt-get clean: Removes all cached .deb files from /var/cache/apt/archives/
- apt-get autoclean: Removes only obsolete cached files that can no longer be downloaded from repositories

This typically frees up several hundred MB to a few GB of space.

2Remove unused dependencies

Run this command to remove packages that were automatically installed as dependencies but are no longer needed:

bash
sudo apt-get autoremove

You may also want to remove unnecessary packages you've manually installed:

bash
sudo apt-get remove PACKAGENAME

Replace PACKAGENAME with any unnecessary packages. You can list installed packages with apt list --installed.

3Check disk usage and identify space hogs

Verify how much space you've freed and identify what else is consuming disk space:

bash
df -h /
sudo du -h --max-depth=1 /var | sort -h | tail -n 10

The first command shows overall root partition usage. The second shows what's consuming the most space in /var. Common culprits include:
- /var/log: System logs (check with ls -lahS /var/log)
- /var/lib: Databases, Docker images, package managers
- /var/cache: Other cached application data

You can safely delete old log files if needed:

bash
sudo rm /var/log/auth.log.1 /var/log/syslog.1
4Remove large unnecessary applications

If after cleaning the cache you still lack space, identify and remove large applications you don't need:

bash
sudo apt-get remove APPLICATIONNAME
sudo apt-get autoremove

Common space-consuming applications:
- Docker/Podman: Often stores gigabytes of images
- LibreOffice: Large office suite
- Unnecessary language packs or fonts

Check what's actually using space:

bash
du -h --max-depth=1 /var/lib | sort -h | tail -n 5
5Retry your installation or upgrade

Once you've freed sufficient space, retry your original command:

bash
sudo apt-get install PACKAGENAME
# or
sudo apt-get upgrade

You should now have enough space to download and cache the necessary package files.

Advanced notes

On Raspberry Pi devices with limited storage, you may need to expand the root filesystem using sudo raspi-config and selecting the expand root filesystem option. For systems using LVM (Logical Volume Manager), you can dynamically allocate more space to /var without reinstalling: run sudo pvresize /dev/sdXN followed by sudo lvextend -l +100%FREE /dev/vg0/root and sudo resize2fs /dev/vg0/root. On systems running in Docker or VirtualBox, consider increasing the virtual disk size in the VM settings before expanding partitions. The journal log file (journalctl) can be trimmed with sudo journalctl --vacuum-size=64M to reclaim additional space without affecting active services. For production systems, consider implementing logrotate to automatically compress and remove old logs: check /etc/logrotate.d/ for existing policies.

Frequently asked questions

What does "E: You don't have enough free space in /var/cache/apt/archives/" mean?
APT (Advanced Package Tool) caches downloaded package files in /var/cache/apt/archives/ to avoid re-downloading them during future installations. When this directory or the root partition runs out of space, APT cannot proceed with updates or installations. This typically happens on systems with limited storage, such as Raspberry Pi devices, containerized environments, or machines with multiple large applications installed.
How do I fix "E: You don't have enough free space in /var/cache/apt/archives/"?
This error occurs when the APT package manager runs out of disk space while downloading packages. Clear the cache and reclaim storage from unused dependencies and applications.
What causes "E: You don't have enough free space in /var/cache/apt/archives/"?
The /var/cache/apt/archives directory contains cached .deb files from previous installations that have accumulated over time The root partition is full or nearly full from other applications and system files Large applications like Docker, virtual machines, or databases are consuming significant disk space
Is the "E: You don't have enough free space in /var/cache/apt/archives/" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading