Not enough space in /var/cache/apt/archives/

  • Debian 10 desktop with persistence
root@debian:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           767M   19M  749M   3% /run
/dev/sdb1       2.9G  2.9G     0 100% /run/live/persistence/sdb1
/dev/loop0      2.6G  2.6G     0 100% /run/live/rootfs/filesystem.squashfs
tmpfs           3.8G     0  3.8G   0% /run/live/overlay
/dev/sdb3       4.9G  4.6G   32M 100% /run/live/persistence/sdb3
overlay         4.9G  4.6G   32M 100% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.8G     0  3.8G   0% /sys/fs/cgroup
tmpfs           3.8G   56K  3.8G   1% /tmp
tmpfs           767M  6.8M  761M   1% /run/user/1000
tmpfs           767M  8.0K  767M   1% /run/user/0
/dev/sda2       239G  229G   10G  96% /media/root/741229F01229B7CE
/dev/sdb4       2.0G   61M  2.0G   3% /media/root/cache-apt
  • apt-get update executes without a single error

  • Something happened to firefox-esr on this system.

  • sudo apt install -y python3-venv

    Depends: python3-distutils (>= 3.7.2-1~) but it is not going to be installed
    
  1. debian requires firefox-esr or chromium to be installed. This causing problems with venv install.
  2. Fix broken firefox-esr:
 :~# apt --fix-broken install
The following packages will be upgraded:
firefox-esr
1 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
66 not fully installed or removed.
Need to get 56.0 MB of archives.
After this operation, 19.5 kB of additional disk space will be used.
E: You don't have enough free space in /var/cache/apt/archives/.
  • Try apt cleaning options
sudo apt-get autoclean
sudo apt-get autoremove 
sudo apt-get clean
  • Try re-route the location where .debs are stored:

Link: re-route the location where .debs are stored

mkdir /media/apt-mount/
mount /dev/sdb4 /media/root/cache-apt/
sudo mv -i /var/cache/apt /media/apt-mount/
ln -s /media/apt-mount/apt/ /var/cache/apt

apt-get update still executes without any error msg

apt --fix-broken install still causes

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

How to fix not enough free space error ?


Solution 1:

You could try to purge removed packages with lingering data with dpkg like

sudo dpkg -P $(dpkg -l | awk '$1=="rc"{print $2}' | xargs)

This also cleans out old kernels properly.

Explanation for the awk command is that it find lines where the first column is rc and prints the second column.