2

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?

4 Answers 4

3

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

  1. Delete trouble packages
  2. Copy the packages back into the repository
  3. Run the repository update script sudo /usr/local/deb/update

You might also edit your apt sources.list to remove all repos except your local one.

2
  • You mean it's a difference between the information in Packages.gz file and the .deb files? Very weird, update of Packages.gz is part of the release process, before to upload file to APT server. And the update process is update first, upgrade after. Jun 22, 2011 at 10:48
  • I got that same error running pbuilder. Re-run pbuilder fixed the problem. So I suppose the cache got reset somehow. Jun 10, 2015 at 6:14
4

Non of the above answers worked for me. It turned out that the problem was related to some proxy & HTTP/1.1 pipelining

apt-get -o Debug::Acquire::http=true update

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

1

I'm running Ubuntu 11 and deleted all *.deb under /var/cache/apt/archives/

Then ran: apt-get --fix-install install

Seemed to work.

0

I'm running Elementary OS:

To delete downloaded packages (.deb) already installed (and no longer needed)

sudo apt-get clean

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).

sudo apt-get autoclean

To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)

sudo apt-get autoremove

This fixed my errors.

1
  • I find this answer a bit difficult to follow. The connection between the original error message in your list of commands is not obvious.
    – kasperd
    Oct 13, 2015 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .