Monday, April 10, 2023

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

If the root directory is tight and

apt-upgrade 

is giving you:

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

then you can move apt's cache somewhere else:

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

later undo with:

rm /var/cache/apt
mv /home/apt /var/cache

--------------------------------------------------------

various housekeeping things

apt clean 

apt autoremove

journalctl --rotate

journalctl --vacuum-time=1s 

remove old logs

find /var/log -mtime +2 -type f -delete

rm /var/cache/locate/locatedb

-------------------------------------------------------

other things that may help actually squeeze the root filesystem 


find all the files larger than 50M on the / partition (ignoring sub-mounts!)
find / -mount -type f -size +50M -exec du -h {} \; | sort -n
 
find installed packages in size order 
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'


No comments:

Post a Comment