24

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.

4 Answers4

24

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

Software & Update

8

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.

K7AAY
  • 17,202
  • 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 08 '19 at 20:22
0

I had this same problem and could not solve it by changing mirrors (it was for xpra, a third-party repository that is only hosted in one place). After banging my head against the wall, I finally resorted to copying the correct sources from another system with the same repository configuration. This worked.

$ mkdir /tmp/lists
$ cd /tmp/lists
$ scp -p otherhost:'/var/lib/apt/lists/*xpra*' .
$ sudo chown root:root *
$ sudo cp -pi * /var/lib/apt/lists/
$ sudo apt update

I can't determine why this worked, but it did. Perhaps there was some misconfiguration on the xpra repository servers, but I couldn't find where the size mismatch came from when manually spelunking through the /dists area of the repository server.

Adam Katz
  • 784
  • 8
  • 18
-1

Update the /etc/apt/sources.list with one of the mirror links below and comment on the previous repository link until the mirror sync is completed.

https://launchpad.net/ubuntu/+archivemirrors

Eg: For Ubuntu 18.04 Version you can update your /etc/apt/sources.list with the below lines

deb http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ bionic main 
deb-src http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ bionic main