1

Or to put the question differently; what is the point of a persistent APT cache that seemingly doesn't get rid of downloaded packages immediately after install? Does anyone even know what is the eviction policy, is there one?

I find on internet all kinds of articles on Ubuntu maintenance how-to's involving the apt-cache clean command and there's also questions asked on this site how to disable the cache or automagically clean it - which may be very useful, sure, but I first need to figure out why files are left sitting around in the cache and what the default eviction policy is.

I as a human - when I install new software, I download install files somewhere, but after install I delete them. I see no point at all just leaving crap behind forever and ever, and I certainly don't have the need to reinstall the same software over and over again. In fact, re-installs are like extremely rare, right? So, this is what I just can't for the life of me understand, why do Ubuntu act different from what I am pretty sure is the human behavior of most of us?

Edit: This question doesn't ask about the eviction policy and the accepted answer quickly spirals into a tutorial on package management, briefly answering my question simply with the files are there "in case they're needed for future use". This last part is exactly what I am asking about. WHAT future use? And, what is the default eviction policy? Lots of IT admin articles out there suggest a "regular cleaning", I am pretty mind-struck why I have to do this myself.

Edit 2: I know why files were put in the cache folder. I am asking WHY ARE THEY LEFT IN THERE and what is the eviction policy? Seriously, stop voting this as a duplicate. You're not helping the community.

  • 2
    One obvious reason: if things go wrong after upgrading something and you can't get a network connection (not all that surprising a situation if you look at how old apt is), you have the old version in the cache to immediately downgrade. This might even be necessary - some (most?) repos don't keep superseded versions of packages. – muru Mar 04 '21 at 09:59
  • People mess things up regularly so uninstalling and reinstalling is a handy technique so it can save the download which in some places is significant. It can also be useful to roll back to an earlier version of something under some circumstances. It’s easier to do that from the cache. However more often than not I delete it too – PonJar Mar 04 '21 at 10:03
  • When you need to use the feature, you'll love that it's there.. Think yourself lucky that you haven't needed to use it.... (though I'd suspect most users don't need to use it) – guiverc Mar 04 '21 at 10:18
  • Thank you for the links. I edited my answer to clarify. In short, no. – Martin Andersson Mar 04 '21 at 10:37
  • Guys, thank you for your comments. I understand the "reinstall" aspect; network connection, fails with the new install, et cetera. But to clarify, that is exactly what we humans do too. Until we've successfully installed the software. Then we remove the install files we temporarily downloaded somewhere. Apparently, Ubuntu keeps them around for a very long time, not just until after install, the first reboot or whatever. For how long is what I am trying to figure out, and of course, how is that motivated. – Martin Andersson Mar 04 '21 at 10:42
  • How long are the files kept and why are they kept in the first place are two entirely different questions. – muru Mar 04 '21 at 10:53
  • It is a design decision. /etc/apt/apt.conf.d/ holds all the settings for this :) – Rinzwind Mar 04 '21 at 12:39
  • muru, exactly my point lol. Right on! – Martin Andersson Mar 04 '21 at 13:55
  • 1
    I've voted to reopen this. It's been closed as a duplicate of Why are there deb files in /var/cache/apt/archives/? based on the idea that the answer there (which I wrote) answers this, but I don't see how it does. As you say, "in case they're needed for future use" doesn't answer what you are asking. That question is asking why the files are placed there in the first place, not why they are kept around, so I don't think I should've tried to answer this there. But if this is really to be considered a duplicate, then someone should post a second answer there. – Eliah Kagan Mar 04 '21 at 15:48

0 Answers0