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

Add max attempts to package manager loop #18

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

barrettj12
Copy link
Contributor

When bootstrapping an LXD controller (or adding a new machine), it tries to apt-get install certain dependencies. A problem arises when the new machine cannot connect to the apt archive for whatever reason. The apt-get install is run in an infinite loop, and so the bootstrap hangs forever.

This PR adds a max of 5 attempts to the loop, so that the user will get a failure instead of an infinite hang.

QA steps

Copy this branch to local machine and run

go mod edit -replace=github.com/juju/packaging/v2=<local/path>
make go-build

Turn off your internet connection and run

$ juju bootstrap lxd c
...
Running machine configuration script...
...
Err:1 http://archive.ubuntu.com/ubuntu focal/main amd64 msr-tools amd64 1.3-3
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal/main amd64 cpu-checker amd64 0.7-1.1
  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/msr-tools/msr-tools_1.3-3_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/c/cpu-checker/cpu-checker_0.7-1.1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
...
ERROR failed to bootstrap model: subprocess encountered error code 100 

Bug reference

https://bugs.launchpad.net/juju/+bug/1969706
https://bugs.launchpad.net/juju/+bug/1993914

Copy link
Member

@tlm tlm left a comment

Choose a reason for hiding this comment

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

lgtm

@barrettj12 barrettj12 merged commit 6786bbb into juju:master Oct 24, 2022
@barrettj12 barrettj12 deleted the apt-timeout branch October 24, 2022 23:50
jujubot added a commit to juju/juju that referenced this pull request Oct 25, 2022
#14811

Pulls in juju/packaging#18 and fixes the issue described there (bootstrap hanging forever).

## QA steps

Turn off your internet connection and run

```console
$ juju bootstrap lxd c
...
Running machine configuration script...
...
Err:1 http://archive.ubuntu.com/ubuntu focal/main amd64 msr-tools amd64 1.3-3
 Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal/main amd64 cpu-checker amd64 0.7-1.1
 Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/msr-tools/msr-tools_1.3-3_amd64.deb Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/c/cpu-checker/cpu-checker_0.7-1.1_amd64.deb Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
...
ERROR failed to bootstrap model: subprocess encountered error code 100 
```

## Bug reference
https://bugs.launchpad.net/juju/+bug/1969706
https://bugs.launchpad.net/juju/+bug/1993914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants