Child pages
  • Getting around apt-get's too strict timestamp checks (and other caching problems)
Skip to end of metadata
Go to start of metadata

Sometimes apt-get update produces errors like ...

W: Failed to fetch
http://at.archive.ubuntu.com/ubuntu/dists/jaunty-updates/universe/main/binary-amd64/Packages.bz2
Hash Sum mismatch

... and refuses to accept that archive.

Unfortunately neither apt-get clean (does not clean cached lists) nor cleaning any proxy help around.
Sometimes, aptitude update works, because aptitude makes less checks on timestamps of locally stored lists (against whatever the mirror's server timestamps the file) and/or uses other HTTP headers!?

This is all a flaw of the Debian archive and mirroring system ;-((

But finally, I seem to have found a solution:

/bin/rm /var/lib/apt/lists/*Packages* /var/lib/apt/lists/*Release* /var/lib/apt/lists/*Sources*

... totally cleans locally cached package and forces apt-get to totally re-GET those files.
If you want to keep traffic minimal you might try to only delete the "bad" files.

To to the cleanup for all OpenVZ machines from the host, use this loop:

for V in $(vzlist -H -o ctid) ; do test -d /vz/private/$V/var/lib/apt/lists && rm -fv /vz/private/$V/var/lib/apt/lists/*Packages* /vz/private/$V/var/lib/apt/lists/*Release* /vz/private/$V/var/lib/apt/lists/*Sources* ; done



From: IBCL BLog.
Originally updated: 2009-10-29

  • No labels