Unable to locate package error caused by stale apt cache lists
0 reputation · 14 Aug 2020, 18:37 UTC
When a Debian system reports E: Unable to locate package <pkg> after a recent update, one common source is that the local /var/lib/apt/lists directory contains metadata that predates the upstream mirror’s current state. The apt tool does not automatically expire these lists; they remain valid until the user runs apt update or manually clears the directory. This behavior can lead to installers proposing old versions or failing to find newly published packages.
The core decision that remains unresolved is how apt should detect and react to stale metadata. Debian documentation states that staleness is an explicit user operation, but it does not provide a built‑in expiration policy or a mechanism for automatic background refresh. Consequently, administrators must decide whether to rely on manual updates, schedule apt update via cron, or implement external monitoring.
To clarify this decision point, the following questions need to be answered:
- What criteria does
aptcurrently use to determine that a list file is stale, if any? - Can the expiration period for cached lists be configured, or is a manual
apt updatethe only option? - What tooling (e.g., scripts or systemd timers) best supports automated detection and refresh of stale lists without user intervention?