Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

apt-get calls don't set DPkg::Lock::Timeout, fail immediately on dpkg lock contention

未关闭 适合新手
#449 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
shell
领域
devops

调研方向

检查安装脚本中的每个 apt-get 调用,包括 L1533-L1560 处的 APT_DEPS 重试循环。保持现有的 Acquire::Retries 行为,同时一致地添加建议的 DPkg::Lock::Timeout 选项。完成标准是:发生 dpkg 锁竞争时,apt-get 会等待,而不是立即失败。

由索引模型根据 Issue 内容生成。

描述

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[@]}"
主要语言
Shell
星标
17
派生
14
平均合并
2 天 22 小时
30 天内合并 PR
7

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DataDog/agent-linux-install-script 的其他 Issue

查看 DataDog/agent-linux-install-script 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。