3

I've noted sometimes after apt install something deb files are left in /var/cache/apt/archives/ but sometimes they are gone right after installation.

I've read comprehensive explanation of install process in Ubuntu in Why are there deb files in /var/cache/apt/archives/? but there is nothing there on how/when deb files get deleted from cache, it says:

.deb package files remain cached in /var/cache/apt/archives even after successful installation in case they're needed for future use.

Web search gave no results to the specific question of my concern. Why sometimes deb files get deleted immediately after installation?

ADDED: Just before installing that something I manually deleted all previous debs from /var... maybe it mattered and the reason. Probably I should try to use apt clean (just read about it in https://www.cyberciti.biz/faq/can-i-delete-var-cache-apt-archives-for-ubuntu-debian-linux/) instead of manual rm.

ADDED 2: I've just tried to run apt clean before installing another package - empty /var after install again.

1 Answers1

3

You have probably upgraded to a version of apt that does not keep installed packages by default, you can check by running:

apt-config dump | grep 'Keep-Downloaded-Packages'

and you will likely see:

Binary::apt::APT::Keep-Downloaded-Packages "0";

If that's the case then you can keep packages again by changing that setting to 1/true:

echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' | sudo tee /etc/apt/apt.conf.d/99-keep-downloads
Compholio
  • 408