I created a private deb repository to spread a software and it's updates to 600 Ubuntu netbooks. Each time the network is connected, my script try to do a apt-get update.
But sometimes (quite often in fact), I have this :
Failed to fetch https://myserver/ubuntu/dists/maverick/main/binary-i386/voosicomat.deb **Size mismatch**
The server is an 2.2 Apache, HTTPS only. There is no error on it's logs.
Here is the script :
apt-get update
apt-get dist-upgrade --force-yes --yes
Here is the complete output of apt-get
Ign https://myserver maverick Release.gpg
Ign https://myserver/ubuntu/ maverick/main Translation-en
Ign https://myserver maverick Release
Ign https://myserver maverick/main i386 Packages/DiffIndex
Ign https://myserver maverick/main i386 Packages
Ign https://myserver maverick/main i386 Packages
Hit https://myserver maverick/main i386 Packages
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
majdb utilitaires voosicomat
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6207kB/6273kB of archives.
After this operation, 0B of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
utilitaires voosicomat majdb
Get:1 https://myserver/ubuntu/ maverick/main voosicomat all 2.0.1 [4755kB]
Get:2 https://myserver/ubuntu/ maverick/main majdb all 1.0.17 [1452kB]
Failed to fetch https://myserver/ubuntu/dists/maverick/main/binary-i386/voosicomat.deb Size mismatch
Fetched 7091kB in 21s (324kB/s)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Non of the above answers worked for me. It turned out that the problem was related to some proxy & HTTP/1.1 pipelining
showed some crazy Last-Modified Headers from 2012... We also had the problem, that downloaded packages had different content as what we expected, that was very strange
The solution was to disable http pipelining for apt
1) create a file
/etc/apt/apt.conf.d/00httppipeline
2) copy&paste
Acquire::http::Pipeline-Depth "0";
3) delete apt cache
rm -rf /var/cache/apt/*
after that, the size mismatch or hash size mismatch errors disappeared and I could upgrade my packages
Your issue is probably a repo bug. If the index isn't updated on the repo, then you'll get the (not very helpful)
Size mismatch
error.A possible fix is to update your repo by
sudo /usr/local/deb/update
You might also edit your apt sources.list to remove all repos except your local one.
I'm running Ubuntu 11 and deleted all *.deb under /var/cache/apt/archives/
Then ran: apt-get --fix-install install
Seemed to work.
I'm running Elementary OS:
To delete downloaded packages (.deb) already installed (and no longer needed)
To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).
To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)
This fixed my errors.