Hi,
On one hand there is
apt/apt-private/private-download.cc/CheckFreeSpaceBeforeDownload()
function that checks only if target location has enough space for
downloaded files.
One of calls of this function is made for "Dir::Cache::Archives"
location. I assume that this call is relevant to this ticket, and that
the function confirms if there is enough free space in
/var/cache/apt/archives/ for downloaded packages.
Actually the function checks if a mounted file system in which given
path exists has enough free space, but this is an irrelevant detail.
The function doesn't check any file system usage limits hardcoded in
code or specified by configuration. It just compares "need to download"
size with "space available on file system" size.
I have checked this in one of most recent commits to apt's git, but the
function was added in
https://salsa.debian.org/apt-team/apt/-/commit/9c81f8de38df940559d13a3ea9591d63cbe970bb,
replacing an already existing similar code.
On the other hand there is a /usr/lib/apt/apt.systemd.daily script and a
/usr/lib/systemd/system/apt-daily.service systemd service.
Part of the script can remove packages from /var/cache/apt/archives/
when the script is invoked in a specific way, and when certain
conditions are met. The conditions include the following parameters that
are described on top of the script:
APT::Periodic::MaxAge
APT::Periodic::MinAge
APT::Periodic::MaxSize
It looks like the service and the script may overlap with reporter's
expectations, but I can't tell to what degree.
I have checked this on a system with apt 2.6.1.
Kamil