Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail and retry on "Some index files failed to download" #911

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nobuto-m
Copy link
Contributor

APT doesn't error out even in the following case since it's a warning instead of an error. And it allows charms to move on without having a proper APT index and let them install unwanted versions of software for example. The apt_update part should fail if it's marked as fatal in such cases so that it can be retried or charm can raise it as an error to users appropriately.

"--error-on=any" is supported for >= bionic.
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1693900

Closes: #910

[w/o "--error-on=any"]

$ sudo apt-get update; echo $?

...

Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
  Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2).
    - connect (113: No route to host)
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2).
    - connect (113: No route to host)
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  Unable to connect to squid-deb-proxy.lxd:8000:
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Unable to connect to squid-deb-proxy.lxd:8000:
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease
  Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2).
    - connect (113: No route to host)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease
  Unable to connect to squid-deb-proxy.lxd:8000:

...

W: Some index files failed to download. They have been ignored, or old ones used instead.

-> 0

[w/ "--error-on=any"]

$ sudo apt-get --error-on=any update; echo $?

...

E: Some index files failed to download. They have been ignored, or old ones used instead.

-> 100

APT doesn't error out even in the following case since it's a warning
instead of an error. And it allows charms to move on without having a
proper APT index and let them install unwanted versions of software for
example. The apt_update part should fail if it's marked as fatal in such
cases so that it can be retried or charm can raise it as an error to
users appropriately.

"--error-on=any" is supported for >= bionic.
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1693900

Closes: juju#910

[w/o "--error-on=any"]
```
$ sudo apt-get update; echo $?

...

Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
  Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2).
    - connect (113: No route to host)
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2).
    - connect (113: No route to host)
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  Unable to connect to squid-deb-proxy.lxd:8000:
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Unable to connect to squid-deb-proxy.lxd:8000:
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease
  Could not connect to squid-deb-proxy.lxd:8000 (10.0.8.2).
    - connect (113: No route to host)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease
  Unable to connect to squid-deb-proxy.lxd:8000:

...

W: Some index files failed to download. They have been ignored, or old ones used instead.
```
-> 0

[w/ "--error-on=any"]
```
$ sudo apt-get --error-on=any update; echo $?

...

E: Some index files failed to download. They have been ignored, or old ones used instead.
```
-> 100
Copy link
Collaborator

@wolsen wolsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

nobuto-m added a commit to nobuto-m/operator-libs-linux that referenced this pull request Aug 21, 2024
In scripting apt operations, adding `--error-on=any` to `apt-get update`
is necessary to capture erros like "Some index files failed to
download". Otherwise, charms move onto package installations with a
stale index.

equivalent to: juju/charm-helpers#911
ref: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1693900
benhoyt pushed a commit to canonical/operator-libs-linux that referenced this pull request Aug 21, 2024
* Fail and retry on "Some index files failed to download"

In scripting apt operations, adding `--error-on=any` to `apt-get update`
is necessary to capture erros like "Some index files failed to
download". Otherwise, charms move onto package installations with a
stale index.

equivalent to: juju/charm-helpers#911
ref: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1693900

* Bump the patch version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants