What counts as transient errors in apt-get update?

Asked by Karthik

https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1693900 says

> We introduce a new flag, --error-on=any that makes apt update also error out on transient errors.

Without using this flag, _transient errors_ with `apt-get update` should return a 0 as error code.

What kind of errors are transient according to apt-get? On Ubuntu 18.04, the following error returned an error code 100.

E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/binary-amd64/Packages.gz File has unexpected size (2770332 != 2770327). Mirror sync in progress? [IP: 80]
   Hashes of expected file:
    - Filesize:2770327 [weak]
    - SHA256:93e61cef2cdc72ca9ead54c52dcfe31fe56646bc72429dcb33e9c4a163318cec
    - SHA1:44ff7061550fa1d606b8596f1a515e378d7df43b [weak]
    - MD5Sum:9b203959f5d997068ff6791bd8650773 [weak]
   Release file created at: Thu, 23 Sep 2021 16:47:21 +0000
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/universe/binary-amd64/Packages.gz
E: Some index files failed to download. They have been ignored, or old ones used instead.


My use case is I have an internal apt-mirror. When the internal mirror or upstream goes down, I should be able to fall back to the other one (upstream or internal) automatically and `apt-get update` should return error code 0.

Question information

English Edit question
Ubuntu apt Edit question
No assignee Edit question
Solved by:
Manfred Hampl
Last query:
Last reply:
Revision history for this message
Best Manfred Hampl (m-hampl) said :

As far as I can see from the source (connect.cc) some network errors like "Unable to connect to ...", "Cannot initiate the connection to ...", "Could not resolve ...","Temporary failure resolving ..." and similar are rated "transient".

Revision history for this message
Karthik (knzivid) said :

Thanks Manfred Hampl, that solved my question.