apt-get calls don't set DPkg::Lock::Timeout, fail immediately on dpkg lock contention
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Inspect every apt-get call in the installation script, including the APT_DEPS retry loop at L1533-L1560. Add the suggested DPkg::Lock::Timeout option consistently while preserving the existing Acquire::Retries behavior. Done means apt-get waits for dpkg lock contention instead of failing immediately.
Written by the indexing model from the issue text.
Description
Title
apt-get calls don't set DPkg::Lock::Timeout, fail immediately on dpkg lock contention
Description
None of the script's apt-get calls set DPkg::Lock::Timeout, so any of them fail immediately if another process holds the dpkg lock (e.g. cloud-init running a concurrent apt-get on first boot):
Installing package(s): datadog-agent datadog-signing-keys
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 2332 (apt-get)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
ERROR
Failed to install one or more packages...
Acquire::Retries, used on the install calls, only retries failed downloads, not lock acquisition. apt has a built-in flag for this: -o DPkg::Lock::Timeout=<seconds> makes apt poll for the lock instead of failing immediately.
Suggested fix
Add -o DPkg::Lock::Timeout='<n>' to every apt-get call in the script.
Potential Improvement
If/when support for earlier versions of apt is dropped, the APT_DEPS retry loop (L1533-1560) could be removed in favor of DPkg::Lock::Timeout, which is silently ignored on older apt:
$sudo_cmd apt-get update -o DPkg::Lock::Timeout="60"
$sudo_cmd DEBIAN_FRONTEND=noninteractive apt-get install -o Acquire::Retries="5" -o DPkg::Lock::Timeout="60" -y "${APT_DEPS[@]}"
- Dominant language
- Shell
- Stars
- 17
- Forks
- 14
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataDog/agent-linux-install-script
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
DataDog/agent-linux-install-script#354 · 1 comment · 1 reaction ·
All issues in DataDog/agent-linux-install-script
Similar issues
-
Bob Shell support Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
tooling
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
openSUSE/python-rpm-macros#219 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
YunoHost-Apps/adguardhome_ynh#258 ·
-
steam-short-session-tracker: incorrect registry backup path resets settings during automatic repair Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
ValveSoftware/SteamOS#2829 ·