apt-get calls don't set DPkg::Lock::Timeout, fail immediately on dpkg lock contention
还没有人认领这个 Issue。
评估
调研方向
检查安装脚本中的每个 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DataDog/agent-linux-install-script 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 52/100
-
enhancement
难度 3/5 1-2 天 新手友好度 45/100
DataDog/agent-linux-install-script#354 · 1 条评论 · 1 个 reaction ·
查看 DataDog/agent-linux-install-script 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 65/100
-
tooling
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
openSUSE/python-rpm-macros#219 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
YunoHost-Apps/adguardhome_ynh#258 ·
-
steam-short-session-tracker: incorrect registry backup path resets settings during automatic repair 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
ValveSoftware/SteamOS#2829 ·