Cluster init script fails with mirror sync in progress error

If the mirror you are using is not in sync with the main repository, apt-get update returns a Mirror sync in progress error.

Written by harrison.schueler

Last published at: October 31st, 2022


You are using a custom init script running at cluster start to install a custom library. It works most of the time, but you encounter intermittent failures when apt-get update runs in the init script.

The failures return a Mirror sync in process error message.

Failed to fetch https://repos.<site>.com/zulu/deb/dists/stable/main/binary-amd64/by-hash/SHA512/<filename>  File has unexpected size (228870 != 201863). Mirror sync in progress? File has unexpected size (228870 != 201863). Mirror sync in progress? [IP: 443]


This can happen if you are trying to download from a mirror that is not in sync with the main repository. Official repositories usually resolve the issue within 30 minutes, however in rare cases it can take much longer.


Wait for the mirror to finishing synchronizing with the repository before attempting to start your cluster.

Alternatively, if the library causing the failure is no longer needed, you can edit your init script to remove the reference to the problematic repo. You should only take this step if you are positive the library is not used directly or as a dependency.



If the repo you are using has multiple mirrors, you can edit /etc/apt/sources.list or /etc/apt/sources.list.d to remove the problematic mirror and point to another mirror instead. This allows the init script to complete.

This is not recommended as a long term solution.

Was this article helpful?