我正在尝试运行 apt-get update 并为 gitlab-runner 收到此错误:
# apt-get update
.
.
.
Get:6 https://packages.gitlab.com/runner/gitlab-runner/ubuntu focal InRelease [23.5 kB]
Err:6 https://packages.gitlab.com/runner/gitlab-runner/ubuntu focal InRelease
The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
Reading package lists... Done
W: GPG error: https://packages.gitlab.com/runner/gitlab-runner/ubuntu focal InRelease: The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
E: The repository 'https://packages.gitlab.com/runner/gitlab-runner/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
You have new mail in /var/mail/root
#
.
.
.
我已经完成了一些关于这个完全相同的错误的帖子,但没有任何建议可以解决我的问题。
https://docs.gitlab.com/omnibus/update/package_signatures.html#package-repository-metadata-signing-keys上的官方 GitLab 签名密钥指南无法解决该问题。
上面的页面建议:
awk '/deb \[signed-by=/{
pubkey = $2;
sub(/\[signed-by=/, "", pubkey);
sub(/\]$/, "", pubkey);
print pubkey
}' /etc/apt/sources.list.d/gitlab_gitlab-?e.list | \
while read line; do
curl -s "https://packages.gitlab.com/gpg.key" | gpg --dearmor > $line
done
或者
apt-key del 3F01618A51312F3F
curl -s "https://packages.gitlab.com/gpg.key" | apt-key add -
apt-key list 3F01618A51312F3F
解决 gitlab-runner 的包存储库签名密钥已过期的问题,但错误仍然完全相同:
W: GPG error: https://packages.gitlab.com/runner/gitlab-runner/ubuntu focal InRelease: The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
我还尝试了此处和其他地方找到的许多帖子中的步骤来更新存储库签名密钥,但没有任何效果 - 错误仍然相同。
这似乎是一个简单的操作 - 更新 APT 存储库的存储库签名密钥 - 但我究竟该如何执行此操作才能使 gitlab-runner 再次在 Ubuntu 20.04.6 LTS 中可更新和可维护?
这把钥匙
https://packages.gitlab.com/gpg.key
无论我做什么,gitlab-runner APT 存储库的“apt-get update”命令都认为它无效。
有任何想法吗?
谢谢!
(PS - 意识到“apt-key”已被弃用,但我只需要再次更新/可更新 gitlab-runner,现在不介意“apt-key”已被弃用。更新 gitlab-runner 后,我可以花时间学习如何使用 gpg 本身而不是 apt-key 来应对将来的签名到期。)
针对这个问题的官方解答(文字来源如下链接):
https://docs.gitlab.com/omnibus/update/package_signatures#update-keys-after-expiry-extension
到期延长后更新密钥
对于基于 Debian 的发行版:
PackageCloud 一般使用 apt-key,将来会弃用。某些发行版中手动安装或配置的存储库已经使用 Debian 软件包源列表中的签名支持。
确定您使用的是 apt-key 还是签名功能:
如果此 grep 返回任何行,则表明您正在使用签名功能。这优先于任何 apt-key 的使用。如果此 grep 没有返回任何行,则您正在使用 apt-key 功能。
对于签名者,以下脚本(以 root 身份运行)更新 GitLab 存储库的公钥:
对于 apt-key,以下脚本(以 root 身份运行)更新 GitLab 存储库的公钥:
注意在 ubuntu jammy 中测试了它。
移动此包源的旧sources.list并使用curl命令从安装指令重新加载skript。
我的sources.list看起来像这样
不要忘记根据您的版本进行调整。
您可以使用安装脚本中描述的相同步骤:
然后
您可以使用相同的方法来修复
gitlab-ce
和gitlab-ee
您可以按照以下说明更新您的 GitLab Runner 签名。
1. 如何解决这个问题。
需要修复的命令如下
2. 与原版的差异
/etc/apt/sources.list.d/gitlab_gitlab-?e.list
指示 GitLab apt 文件所在的位置。
但 GitLab Runner apt 文件是。
/etc/apt/sources.list.d/runner_gitlab-runner.list
。该
/etc/apt/sources.list.d/gitlab_gitlab-?e.list
文件在运行 Runner 的机器上不存在,因此上面的原始命令不会创建密钥签名文件。3. 检查调号文件是否存在。
运行上面的命令,看看是否创建了以下文件。
/usr/share/keyrings/runner_gitlab-runner-archive-keyring.gpg