apt-get update: fixing 'package index files are corrupted'

Sometimes when performing your daily apt-get update, you'll experience messages like

E: The package lists or status file could not be parsed or opened.


The package index files are corrupted

Such messages usually don't go away for quite a long time, and may prevent legitimate updates from installing.

This usually happens even more frequently if using a proxy to access apt archives.

While I don't know what's the root problem, I've got a quick workaround that seems to fix the immediate error:

sudo -s -H bash -c 'apt-get clean && rm -f /var/lib/apt/lists/* ; rm -f /var/lib/apt/lists/partial/* && apt-get clean && apt-get update'