I was used to apt storing downloaded packages in /var/cache/apt/archives/, but it does not do it anymore and I can't figure out why.

Configuration is set accordingly IMHO:

# apt-config dump | grep -i cache
Dir::Cache "var/cache/apt";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
Binary::apt::APT::Cache "";
Binary::apt::APT::Cache::Show "";
Binary::apt::APT::Cache::Show::Version "2";
Binary::apt::APT::Cache::AllVersions "0";
Binary::apt::APT::Cache::ShowVirtuals "1";
Binary::apt::APT::Cache::Search "";
Binary::apt::APT::Cache::Search::Version "2";
Binary::apt::APT::Cache::ShowDependencyType "1";
Binary::apt::APT::Cache::ShowVersion "1";

Although I don't know about the Binary::* stuff.

It does not seem to be related to any permission issue as well, because /var/cache/apt/archives/ is recreated when using apt install <arbitrary-package>.

Any hints?

2 Answers 2


There's a dedicated setting for this which appeared in 2016 (that is including the Debian 9 stable release):

apt (1.2~exp1) experimental; urgency=medium

  [ Automatic removal of debs after install ]
  After packages are successfully installed by apt(8),
  the corresponding .deb package files will be
  removed from the /var/cache/apt/archives cache directory.

  This can be changed by setting the apt configuration option
    "Binary::apt::APT::Keep-Downloaded-Packages" to "true". E.g:

  # echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \
      > /etc/apt/apt.conf.d/01keep-debs

  Please note that the behavior of apt-get is unchanged. The
  downloaded debs will be kept in the cache directory after they
  are installed. To enable the behavior for other tools, you can set
  "APT::Keep-Downloaded-Packages" to false.

So there are two toggles:

the apt command specific toggle:


which can be set to "true" to change apt's default.

and the global toggle:


which can be set to "false" to change among other tools apt-get's default.

So if for example you want to completely invert the current behaviours of apt ("don't keep" to "keep") and apt-get ("keep" to "don't keep") in Debian 10, you'd add this somewhere in /etc/apt/apt.conf.d/:

Binary::apt::APT::Keep-Downloaded-Packages "true";
APT::Keep-Downloaded-Packages "false";

Note: if the file was already present (eg: previously downloaded with --download-only), it's possible the settings won't have any effect and the file will stay. This might depend on apt's version. The behaviour is consistent at least when the command downloads the package and installs it.


Rubber duck asking worked. While writing the two last paragraphs, I realised that apt install works differently to apt-get install in this context.

The manpage of apt explains this (emphasis mine):

All features of apt(8) are available in dedicated APT tools like apt-get(8) and apt-cache(8) as well. apt(8) just changes the default value of some options (see apt.conf(5) and specifically the Binary scope).

(See also section BINARY SPECIFIC CONFIGURATION in man apt.conf.)

Unfortunately the behaviour does not change, although I added these two lines to a file in /etc/apt/apt.conf.d:

Binary::apt::APT::Cache "/var/cache/apt";
Binary::apt::APT::Cache::Archives "archives";

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .