Ubuntu 18.04 LTS GitLab 金鑰過期處理方法

今天在 Ubuntu 上面更新 GitLab Runner 時發生簽名過期問題 The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) [email protected]

GitLab 簽名過期

其實套件發生金鑰過期是一件滿容易發生的事情,畢竟金鑰簽名時間只有 2 年,所以只要搜尋一下官方文件下載新的金鑰就可以順利解決了。

Get:6 https://packages.gitlab.com/runner/gitlab-runner/ubuntu bionic InRelease [23.5 kB]
Err:6 https://packages.gitlab.com/runner/gitlab-runner/ubuntu bionic InRelease
  The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
Fetched 8,356 kB in 2s (3,464 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
48 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.gitlab.com/runner/gitlab-runner/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
W: Failed to fetch https://packages.gitlab.com/runner/gitlab-runner/ubuntu/dists/bionic/InRelease  The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <[email protected]>
W: Some index files failed to download. They have been ignored, or old ones used instead.

解決方法

遇到這個問題可以可以直接使用官方的 Fetching new keys before 2020-04-06 來解決,執行完以下再重新直接 apt update && sudo apt upgrade 就可以順利更新了。

# Download the new key
curl "https://packages.gitlab.com/gpg.key" -o /tmp/omnibus_gitlab_gpg.key

# Import the key
## Debian/Ubuntu/Raspbian
sudo apt-key add /tmp/omnibus_gitlab_gpg.key

# CentOS/OpenSUSE/SLES
sudo rpm --import /tmp/omnibus_gitlab_gpg.key