apt cache can swell to gigantic proportions

Bug #13116 reported by Eric D
12
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Fix Released
High
Michael Vogt
linux-source-2.6.22 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

This is not necessarily a major bug since I'm using Hoary, and have been keeping
it apt-to-date with apt-get.

My packages cache swelled to 2.2 GB and only b/c I was wondering why I was
running out of room (100% (4.4 G) of a 4.6 G / partition used according to df
-h) did I notice it.

Perhaps it would be useful to have apt-get and/or Synaptic clean out old chaff
to keep the cache below a certain size. I guess a non-beta install of Ubuntu
Hoary final (gold master?) will not see this kind of update activity but it
still might be useful to do regular house cleaning.

Revision history for this message
Matt Galvin (mgalvin) wrote :

(In reply to comment #0)
> This is not necessarily a major bug since I'm using Hoary, and have been keeping
> it apt-to-date with apt-get.
>
> My packages cache swelled to 2.2 GB and only b/c I was wondering why I was
> running out of room (100% (4.4 G) of a 4.6 G / partition used according to df
> -h) did I notice it.
>
> Perhaps it would be useful to have apt-get and/or Synaptic clean out old chaff
> to keep the cache below a certain size. I guess a non-beta install of Ubuntu
> Hoary final (gold master?) will not see this kind of update activity but it
> still might be useful to do regular house cleaning.

In Synaptic go to Settings -> Preferences
go to the Files tab and select "Delete downloaded packages after installation"
and this should clear the apt cache every time you install stuff.

I do this and my cache size after installs is only about 2MB's.

Revision history for this message
Eric D (eric-dunbar) wrote :

(In reply to comment #1)
> In Synaptic go to Settings -> Preferences
> go to the Files tab and select "Delete downloaded packages after installation"
> and this should clear the apt cache every time you install stuff.
>
> I do this and my cache size after installs is only about 2MB's.

I was thinking that it might be useful to have Hoary set the defaults to apt-get
"auto-clean" or "clean" the cache. I am partial to out-right "clean"ing the
cache as a default. The package has been installed, and only a tiny fraction of
people would ever uninstall and then reinstall the same package.

However, depending on how small an "auto-cleaned" cache would be, it might be a
useful compromise to "auto-clean" the cache (I imagine that much of the 2.2 GB
of my cache was from a million and one different versions of the same basic set
of packages).

Revision history for this message
Matt Galvin (mgalvin) wrote :

(In reply to comment #2)
> I was thinking that it might be useful to have Hoary set the defaults to apt-get
> "auto-clean" or "clean" the cache. I am partial to out-right "clean"ing the
> cache as a default. The package has been installed, and only a tiny fraction of
> people would ever uninstall and then reinstall the same package.
>
> However, depending on how small an "auto-cleaned" cache would be, it might be a
> useful compromise to "auto-clean" the cache (I imagine that much of the 2.2 GB
> of my cache was from a million and one different versions of the same basic set
> of packages).

agreed, having apt/synaptic cache auto-cleaning on by default is probably best
as well as what most users would expect.

Revision history for this message
Matt Zimmerman (mdz) wrote :
Revision history for this message
Michael Vogt (mvo) wrote :

The easiest solution would be to just set

APT::Periodic::AutocleanInterval "1";

in /etc/apt/apt.conf.d/10periodic with the next
upload of update-notifier.

Comments?

Revision history for this message
Michael Vogt (mvo) wrote :

Aalternative was suggested by Danilo Piazzalunga on ubuntu-devel:

"""
If autoclean is selected by default both in synaptic and in aptitude (
FYI, aptitude::AutoClean-After-Update "true"), it should be enough for most
users. And I guess that a pure apt-get user wouldn't mind having to clean up
manually.
"""

I'm happy with this solution too.

Revision history for this message
Matt Zimmerman (mdz) wrote :

I don't think that autoclean is sufficient. The upper bound for an autocleaned
cache is the size of the entire Ubuntu archive. In practice, it should be much
less, but after an upgrade to the next release, it will contain all packages
currently installed on the system, which is too much.

I suggest that rather than using autoclean, we either:

- Simply remove files from the cache based on age
- Remove files from the cache, oldest first, until we reach a set maximum size

Revision history for this message
Michael Vogt (mvo) wrote :

I implemented:
APT::Archives::{MaxAge,MaxSize} in:
<email address hidden>/apt--mvo--0

It will first remove all files older than (mtime) MaxAge and then remove one
file after the other (oldest first) until MaxSize (in kb) is reached.

Review/feedback is welcome.

The next bit is to set sensible default to MaxAge and MaxSize (looking into this
right now).

Revision history for this message
Michael Vogt (mvo) wrote :

This problem is fixed with the recent uploads of apt, update-notifier and
update-manager.

The default cache size is now max 500 MB and a maximal age of a package file of
30 days.
This can be fine-tuned with the gnome-software-preferences (part of
update-manager). Apt will check the cache with a cron.daily script and remove
cached packages if needed.

Please reopen if you still have problems.

Cheers,
 Michael

Revision history for this message
Nicolas Dumoulin (nicolas-dumoulin) wrote :

Hello,

It looks that the problem persists. I've two kubuntu dapper up-to-date, a desktop and a laptop. Recently my laptop was unable to log in KDE, because my root partition was fool. And on my desktop, I've currently :
$du -s --si /var/cache/apt/
1,2G /var/cache/apt/

Is it kubuntu specific ?

Revision history for this message
Eugenia Loli-Queru (eloli) wrote :

I have this problem too with Feisty 7.04. My cache at the moment is 650 MBs and growing. I have being installing apps with add/remove, update manager and Synaptic in the last 3 days. But if there is a cap for 500 MBs, it doesn't seem to work here.

Revision history for this message
Mike MacCana (lovekudu) wrote :

I also have the problem with Feisty 7.04. Clean install as of Hurd 3, and my cache is around 600MB.

The problem clearly isn't fixed in the current release.

Revision history for this message
TJ (tj) wrote :

Adding linux-source-2.6.22 to this bug to bring attention to it affecting Gutsy.

Running Gutsy 64-bit Tribe-5 + constant updates the root partition has just run out of space:

$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 5977156 5700308 0 100% /

$ du -s --si /var/cache/apt/
1.1G /var/cache/apt/

Revision history for this message
Fibonacci (fibonacci-prower) wrote :

Same problem here.
I just upgraded to Gutsy using update-manager, and my /var/cache/apt/ dir is currently about 1.6 GiB (1.8 GB).

Changed in linux-source-2.6.22:
status: New → Invalid
Revision history for this message
Åskar (olskar) wrote :

This bug is still a problem in Ubuntu 8.04.1

Revision history for this message
Eduardo Cereto (dudus) wrote :

Still buggy with Intrepid.

Just a n00b question here. Isn' t it necessary to have the package to remove or update it? So it run those remove scripts and such? I' m just wondering if I clean the packages and after that If I want to update them I will have to re-download the package just to remove it. If that's so I prefer to keep the package.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.