How to fix "E: You don't have enough free space in /var/cache/apt/archives/."
Solution 1
If you're getting this error in a Docker container - it helped me to do a
docker system prune
Solution 2
Fixing this largely depends on where the cruft has built up.
- Start with unnecessary packages and apt cache:
sudo apt autoremove && sudo apt autoclean
df -h
- 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.
- 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.
Solution 3
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.
Solution 4
I think var/cache/apt/archives is a bit full soo
apt-get clean packages
Solution 5
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
Related videos on Youtube
Navdeep Gupta
Updated on September 18, 2022Comments
-
Navdeep Gupta over 1 year
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
-
Freddy about 4 yearsI 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/
?
-
-
we.mamat about 3 yearsran this and i got 22 Gigs back 😎
-
inostia about 3 yearsIf using minikube, do
minikube ssh
first to get into the VM.