Technical Solution
How to fix hash sum mismatch and size mismatch errors from apt-get / apt-cacher
We run apt-cacher to save bandwidth in our intranet. All Ubuntu systems in our office uses the apt-cacher server to update and upgrade. Recently we started getting the hash sum mismatch and size mismatch errors. After some dabbling with the settings and the files we figured out a simple solution for this problem.
Whenever we were running apt-get update, apt-get upgrade or apt-get dist-upgrade we were getting these annoying show-stoppers. The exact errors we were receiving were of this form
Once we started getting this error for a package in one of the machines in the network, it reoccurred for the same packet on all the other machines in the network. So we figured that it had something to do with the apt-cacher and we forced a reload of the specific package by going to the apt-cacher repository(we have it at the default location - /var/cache/apt-cacher) and deleting the file with the name for which the error was triggered from within the var/cache/apt-cacher/private folder. This file is a flag which is used to indicate the download status of the specific package.
While doing research on this problem we also realized that a possible solution was to change the repository server to some other server than the one already setup, either manually by editing the sources.list file or by changing it from synaptic package manager. This was how we initially solved the problem to get going but we have a lot of systems and we had only limited bandwidth and we had to save the bandwidth.
We also realized that we started getting this problem once we setup the apt-cacher with expiry-time of 24 hours. It could possibly have been that the packages were updated in between and our cache had gotten stale. So a similar issue could happen when people use proxies or apt-on-cds for updating packages. Once we fixed the errors we set the expiry-time to 0 which meant that new packages.gz files are downloaded every time someone requested for an update/upgrade. Hope this helps.
Zyxware is a leading Drupal web development company in India which has its operations in US, UK, Canada, Australia and Middle East. We provide all kind of Drupal services including Drupal Commerce. If you have any query regarding this, please get in touch with us
W: Failed to fetch http://192.168.1.5:3142/ubuntu/..i386.deb Hash Sum mismatch
or
W: Failed to fetch http://192.168.1.5:3142/ubuntu/...deb Size mismatch
Once we started getting this error for a package in one of the machines in the network, it reoccurred for the same packet on all the other machines in the network. So we figured that it had something to do with the apt-cacher and we forced a reload of the specific package by going to the apt-cacher repository(we have it at the default location - /var/cache/apt-cacher) and deleting the file with the name for which the error was triggered from within the var/cache/apt-cacher/private folder. This file is a flag which is used to indicate the download status of the specific package.
While doing research on this problem we also realized that a possible solution was to change the repository server to some other server than the one already setup, either manually by editing the sources.list file or by changing it from synaptic package manager. This was how we initially solved the problem to get going but we have a lot of systems and we had only limited bandwidth and we had to save the bandwidth.
We also realized that we started getting this problem once we setup the apt-cacher with expiry-time of 24 hours. It could possibly have been that the packages were updated in between and our cache had gotten stale. So a similar issue could happen when people use proxies or apt-on-cds for updating packages. Once we fixed the errors we set the expiry-time to 0 which meant that new packages.gz files are downloaded every time someone requested for an update/upgrade. Hope this helps.
Zyxware is a leading Drupal web development company in India which has its operations in US, UK, Canada, Australia and Middle East. We provide all kind of Drupal services including Drupal Commerce. If you have any query regarding this, please get in touch with us