E: You don't have enough free space in /var/cache/apt/archives/.
root@kali:~# df -H
Filesystem      Size  Used Avail Use% Mounted on
udev            2.0G     0  2.0G   0% /dev
tmpfs           406M  7.0M  399M   2% /run
/dev/sda6        12G   11G  480M  96% /
tmpfs           2.1G   78M  2.0G   4% /dev/shm
tmpfs           5.3M     0  5.3M   0% /run/lock
tmpfs           2.1G     0  2.1G   0% /sys/fs/cgroup
/dev/sda8        58G  114M   55G   1% /home
tmpfs           406M   37k  406M   1% /run/user/0
  • 1
    I don't know what /dev/sda7 is, but you have lots of free space in /dev/sda8. Maybe resize your /home and move the freed space to /?
    – Freddy
    Apr 7 '20 at 18:09

If you're getting this error in a Docker container - it helped me to do a

docker system prune
  • 4
    ran this and i got 22 Gigs back 😎
    – we.mamat
    Feb 24 '21 at 13:11
  • If using minikube, do minikube ssh first to get into the VM.
    – inostia
    Mar 18 '21 at 6:15

Fixing this largely depends on where the cruft has built up.

  1. Start with unnecessary packages and apt cache:
sudo apt autoremove && sudo apt autoclean
df -h
  1. Use du to look for cruft in /var and /var/log.
sudo du -xh --max-depth=1 /var
sudo du -xh --max-depth=1 /var/log

If a lot of space is consumed by /var/log, I usually cleanup old log files with:

# Note, change +30 to the number of days you want to keep.
sudo find /var/log -mtime +30 -type f -delete

Other directories probably need to be handled differently.

  1. Lastly, check if running processes have a lock on files pending deletion.
sudo lsof -nP | grep '(deleted)'
# If your system doesn't have lsof installed:
sudo apt install lsof 

If there are large files pending deletion, you may need to restart the process or daemon with the lock.


Wouldn't apt-get clean free enough space, there is a faster way, than resizing filesystems:

mv /var/cache/apt/ /home/
ln -s /home/apt/ /var/cache/apt

Make sure you there is no /home/apt directory beforehand.


I think var/cache/apt/archives is a bit full soo

apt-get clean packages


In my case, I was getting this error

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

while installing a package inside Debian container.The problem got resolved by going to Docker :

dashboard -> Settings -> Resources 

and increasing the Disc image size from 60G to 80G


I was getting the same problem, but in my case, this problem went away by just rebooting the system. I guess my computer has commutated very much temporary files.

If nothing works, you might give rebooting a try!


this error message showed up on a raspberry pi zero-w with fresh install of Raspbian 10 Buster:

You don't have enough free space in /var/cache/apt/archives/.

The other answers here are valid, but this fresh image had no significant previous packages for removal, so removing them didn't help.

solution (1): use raspi-config --> Advanced --> Expand Filesystem

this will expand the root filesystem to use the entire sd card.

solution (2): or from the command line:

raspi-config --expand-rootfs

This seems to happen quite often when using micro SD as a hard drive for Raspberry Pi.

raspi-config --expand-rootfs

That works for Raspberry Pi OS but if you're using your Pi for Kali you need

kalipi-config --expand-rootfs

It seems every time I use a fresh installation of Kali for the Pi, it won't upgrade without using the command. Rarely though do I require using it on a fresh installation of Raspberry Pi OS.


When you use the Rasp Pi imager it auto partitions boot and bootxx and leaves the rest free not allocated.

The simple fix is:

  1. Open GParted

  2. Within GParted

    • Go down to the second partition
    • Click the move/resize option
    • Allocate the free space to the second disk.
    • Press the check at the top.
  3. In a terminal

    sudo apt update && sudo apt upgrade && sudo apt dist-upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.