#214119 apt-get fails if disk space low

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
"Edward A. Falk"
Date:
2025-08-17 17:47:08 UTC
Severity:
wishlist
Tags:
#214119#5
Date:
2003-10-04 19:15:30 UTC
From:
To:
When I tried to install a package with apt-get, I got this error:

  Need to get 46.9MB/96.2MB of archives.
  After unpacking 24.7MB disk space will be freed.
  E: You don't have enough free space in /var/cache/apt/archives/.

Even after cleaning out the archive, I got this message:

  Err cdrom://Planet CCRMA RH7 Software apt/redhat/7.3/en/i386/planetccrma qt-devel 1:3.1.1-6
    Write error - write (28 No space left on device)

This is all very frustrating for two reasons:  1) there *is* enough disk space
to install any one of the needed packages, and 2) many of the packages where installed
from cd-rom, and really didn't need to be cached.

Work-around:  move /var/cache/apt to a directory on another partition and make
a symlink.


Suggested fix:  apt-get should use an algorithm that goes like this:

	if( not enough disk space to hold all packages )
	  flush all packages from cache that are not actually needed
	  for the install.

	if( enough disk space to hold all the packages )
	  download and install all packages at once, just like before

	else
	  for each package to install:
	    if( not enough disk space to hold this package )
	      flush all packages from the cache that are no longer needed
	      for the install
	    if( still not enough disk space to hold this package )
	      flush all packages from the cache
	    if( still not enough disk space to hold this package )
	      wow, that was a big package; exit with failure code


A cleverer algorithm would remove packages from the cache one by one,
starting with the largest, until there was enough room, but this will
do for a first approximation.


Thank you for your attention,

	-ed falk

p.s. apt-get is great; far better than doing all this by hand with rpm.