Ubuntu – What causes “Failed to fetch … File has unexpected size. Mirror sync progress?” error

aptrepositoryupdatesupgrade

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.

Best Answer

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.