Running out of installation space /

A few days ago I wasn’t able to make temporary downloads (the kind where you open files instead of saving them on prompt in Firefox). Moreover, running any apt installation tasks gave the error: /var/cache/apt/archives is full. Running all clean,autoclean combinations with apt failed. To investigate, I ran df -h which showed:

Filesystem      Size  Used Avail Use% Mounted on
udev            7,8G     0  7,8G   0% /dev
tmpfs           1,6G  1,7M  1,6G   1% /run
/dev/nvme0n1p4   20G   19G  1,0M  99% /
tmpfs           7,8G  270M  7,5G   4% /dev/shm
tmpfs           5,0M  4,0K  5,0M   1% /run/lock
tmpfs           7,8G     0  7,8G   0% /sys/fs/cgroup
/dev/nvme0n1p6  261G  133G  115G  54% /home
/dev/nvme0n1p1  496M   32M  465M   7% /boot/efi
tmpfs           1,6G   16K  1,6G   1% /run/user/1000

which is very strange, as there is enough space in /home! The reason for this is all the installations that happen on root, which was allocated (in this case) 20GB of space during Linux installation.

There is no clear way around this. Sometimes the cleaning methods above fail to remove big files that may be saved at locations other than /var/cache/apt/archives. In this case start sweeping through folders under / using sudo du -ahx -d 1 . | sort -rh | head -20. This displays the 20 largest files/directories in order and you can begin to find the root cause of the problem.

Usually, there are redundant downloads and big root installations that create the problem.