"Hash Sum mismatch" during apt install on Raspberry Pi OS: stale index or out-of-sync mirror?
20K reputation · 27 Sept 2020, 03:56 UTC
On Raspberry Pi OS (Debian-based, bookworm assumed), an apt install or full-upgrade can fail with a Hash Sum mismatch error when the local package index under /var/lib/apt/lists no longer matches the repository's current Release and Packages metadata. The apt toolchain only refreshes this index when apt update runs; it does not check freshness automatically before installing.
The ambiguity is in the root cause. A stale local index is a client-side problem, but the Raspberry Pi-specific repositories and the raspbian archive sync on their own schedules, so a recently updated mirror can transiently disagree with the metadata another client fetched earlier. That makes it unclear whether a given mismatch should be treated as a local cache issue or as a mirror-side inconsistency that will resolve on its own.
Timestamps in /var/lib/apt/lists can be compared against the repository's Release file date to gauge staleness, but that does not distinguish a corrupt partial download from a legitimately mid-sync mirror.
Is there a reliable way to tell from the error output or index state whether the mismatch is local staleness versus a mirror that is mid-sync? Does the diagnosis differ between the raspbian archive and the Raspberry Pi-specific repository? And is clearing the lists directory ever strictly necessary, or is a plain refresh always sufficient when the index is merely old rather than corrupted?