I've seen this error pop up for different people for different repositories. I was just curious what is the exact this error, as I got it the other day. I think I ran "sudo apt update."

E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/bionic/stable/binary-amd64/Packages.bz2 File has unexpected size (9051 != 9594). Mirror sync in progress?

From my impression, it is something that happens when the package containers mess up with something.


Take a look at the official list of Ubuntu mirrors.

See the ones in red? Those are not up to date. They will get up to date, eventually, by syncing with the master repository. When that's underway, file sizes won't match the master file size, and errors like this will occur.

Solution: Use another mirror. How do I change my update server in Ubuntu 18.04? shows how.

| improve this answer | |
  • I'm still having trouble fully understanding. If i'm downloading a package from a mirror, does ubuntu check if the file size of the mirror and master match? At that point, why have mirrors and not just get the package directly from the master? – frownyface Oct 26 '19 at 18:59
  • 1
    Why not? Because Linux users download too much. Having multiple minors scattered all over the planet means folks get their downloads quicker. – K7AAY Oct 27 '19 at 22:45
  • I see, I guess I was confused because I thought it would be more efficient for the package download process to not compare the mirror file size to the master file size. Because I thought at that point just download the package from master. But it makes sense cus it’s saving the process of downloading from mast. So is the comparison for security reasons? – frownyface Oct 27 '19 at 23:16
  • For data integrity. – K7AAY Dec 8 '19 at 20:22

Open Software & Updates and change Download from to the Main Server as said in the link shared by @K7AAY

Software & Update

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.