Fix GitLab Runner public key error (The following signatures couldn't be verified...)
Sometimes `apt-get update` fails with a NO_PUBKEY error when the repository public key is missing. Example:
Update attempt output
# apt-get update
...
Get:8 https://packages.gitlab.com/runner/gitlab-runner/debian stretch InRelease [23.4 kB]
Err:8 https://packages.gitlab.com/runner/gitlab-runner/debian stretch InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
...
Fetched 23.4 kB in 4s (4,794 B/s)
Reading package lists... Done
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/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
W: Failed to fetch https://packages.gitlab.com/runner/gitlab-runner/debian/dists/stretch/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
W: Some index files failed to download. They have been ignored, or old ones used instead.
Import missing key
The missing key can be retrieved from keyserver.ubuntu.com using `apt-key adv --keyserver keyserver.ubuntu.com --recv-keys`.
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
Executing: /tmp/apt-key-gpghome.KMLfZ7U2tz/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
gpg: key 3F01618A51312F3F: public key "GitLab B.V. (package repository signing key) <packages@gitlab.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
Human Logic, AI Syntax...
Note on Content: I'm a Systems Engineer, not a native English writer. To ensure my technical ideas are clear and accessible, I use AI tools to polish the grammar and style. The workflow is simple: I provide the logic, the code, and the real-world experience. The AI handles the "English-to-Human" translation layer. If you find a bug, that's on me. If you find a perfectly placed comma, that's probably the AI.
Nope.
ReplyDelete# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
Executing: /tmp/apt-key-gpghome.CPlL2UxgMW/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
gpg: key 3F01618A51312F3F: "GitLab B.V. (package repository signing key) " not changed
gpg: Total number processed: 1
gpg: unchanged: 1
One more time...
ReplyDeleteError
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/debian stretch InRelease: The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key)
W: Failed to fetch https://packages.gitlab.com/runner/gitlab-runner/debian/dists/stretch/InRelease The following signatures were invalid: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key)
W: Some index files failed to download. They have been ignored, or old ones used instead.
Fix
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
Executing: /tmp/apt-key-gpghome.vwgOh8kKC1/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
gpg: key 3F01618A51312F3F: "GitLab B.V. (package repository signing key) " 2 new signatures
gpg: Total number processed: 1
gpg: new signatures: 2
Done
# apt-get update
...
Get:9 https://packages.gitlab.com/runner/gitlab-runner/debian stretch InRelease [23.5 kB]
Ign:11 https://packages.gitlab.com/runner/gitlab-runner/debian stretch/main amd64 Packages
Get:11 https://packages.gitlab.com/runner/gitlab-runner/debian stretch/main amd64 Packages [18.6 kB]
Fetched 86.9 kB in 1s (73.6 kB/s)
Reading package lists... Done