apt-get update / fetch.apt_update may never terminate

Bug #1491386 reported by Stuart Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
New
Undecided
Unassigned

Bug Description

The apt-get update helper in charm-helpers goes into a loop if it is unable to run successfully. This is no longer desirable behaviour, as in this case the unit should most likely be put into a blocked state. The current implementation makes it very difficult to recover from a simple configuration error, such as a bad GPG key or an invalid password for a protected apt archive.

Revision history for this message
Adam Collard (adam-collard) wrote :

> The apt-get update helper in charm-helpers goes into a loop if it is unable to run successfully. This is no longer desirable
> behaviour, as in this case the unit should most likely be put into a blocked state.

To be clear, it's not an infinite loop, it's 30 attempts with 10s sleep -> 5 minutes.

The rationale for this loop is for two or more units on the same machine all of which are trying to get the APT lock. IMHO it is not appropriate for a unit that hits this APT lock issue to be blocked. There is no user action required (other than try again).

The retry logic is a bit crude at the moment because there's no way of distinguishing lock failures from any others using just the return code. One could probably tighten it up a bit to e.g. force a C locale, and inspect the error message on stderr.

Revision history for this message
Stuart Bishop (stub) wrote :

30 attempts with 10s sleep is a couple of hours (since, at least in the cases I've got, a normal update takes about 1 minute and a failing one quite a bit longer waiting for http timeouts to timeout).

I think the bug here is that there is a fixed number of retries, rather than using the clock to timeout after some reasonable amount of time.

Revision history for this message
Stuart Bishop (stub) wrote :

My user action required is 'check the logs, fix the config', eg. specify the correct apt source or add the correct gpg signing key.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.