apt-get update should return exit code != 0 on error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apt (Debian) |
Fix Released
|
Unknown
|
|||
apt (Ubuntu) |
Fix Released
|
Wishlist
|
Unassigned | ||
Xenial |
Confirmed
|
Wishlist
|
Unassigned | ||
Bionic |
Fix Released
|
Wishlist
|
Unassigned | ||
Focal |
Fix Released
|
Wishlist
|
Unassigned | ||
Groovy |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
[Impact]
There is no way for scripts to run apt update and be sure that it was entirely successful.
We introduce a new flag, --error-on=any that makes apt update also error out on transient errors.
[Test plan]
We have included a test in the test-suite in test-apt-
[Where problems could occur]
If there's an issue some warnings for transient errors could become errors, or worse I suppose it's possible but unlikely for errors to be reported as warnings...
Since the new behavior is behind a flag, regression potential for existing scripts is low if there is no bug.
[Original bug report]
When running 'apt-get update' (e.g. on a container install post-install script), apt-get return with exit code 0, even so it wasn't able to "update" properly. E.g.:
+ apt-get update
Err:1 http://
Temporary failure resolving 'de.archive.
Err:2 http://
Temporary failure resolving 'security.
Err:3 http://
Temporary failure resolving 'de.archive.
Reading package lists... Done
W: Failed to fetch http://
W: Failed to fetch http://
W: Failed to fetch http://
W: Some index files failed to download. They have been ignored, or old ones used instead.
It should be corrected to return useful exit code, so that scripts can take the appropriate actions ...
description: | updated |
description: | updated |
Changed in apt (Ubuntu Groovy): | |
status: | Triaged → In Progress |
description: | updated |
Changed in apt (Ubuntu Xenial): | |
importance: | Undecided → Wishlist |
Changed in apt (Ubuntu Bionic): | |
importance: | Undecided → Wishlist |
Changed in apt (Ubuntu Focal): | |
importance: | Undecided → Wishlist |
Changed in apt (Ubuntu Groovy): | |
importance: | Undecided → Wishlist |
Changed in apt (Debian): | |
status: | Unknown → Fix Released |
Well, it did not fail, it re-used the existing information. Transient network errors do not cause the update to fail, because they are expected to be temporary. It's always been like this. I'm open to possibly changing this, but such a change could cause huge issues.