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: 91.189.88.142 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

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

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 :
#2

Thanks Manfred Hampl, that solved my question.

Revision history for this message
Deny Jhonson (payslipspluss) said :
#4

Please if someone know please let me know thanks.