LoginSignup
13
5

More than 3 years have passed since last update.

【解決済み】GitLab Omnibus が署名の鍵の期限切れでアップデートできなかったのを解消した話

Last updated at Posted at 2020-04-08

毎度、ググっても出てこない小ネタを取り扱っております。
本記事は個人的な見解であり、筆者の所属するいかなる団体にも関係ございません。

0. はじめに

弊社が使っているomnibusでインストールされたGitLabは、以下の記事で書いたように毎日アップグレードされています。

【2019年版】GitLab CE/EEのゼロダウンタイムアップグレード - Qiita
https://qiita.com/ynott/items/7e3d730d12a09e7fdd8b

このスクリプトは、cronで実行された実行結果を毎日メールで送信しています。

先日(正確には、2020年4月6日)から、以下のようなエラーが発生しています。

Hit:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:5 http://ppa.launchpad.net/longsleep/golang-backports/ubuntu xenial InRelease
Hit:6 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu xenial InRelease
Get:7 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial InRelease [23.3 kB]
Err:7 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
Get:8 https://packages.gitlab.com/runner/gitlab-runner/ubuntu xenial InRelease [23.4 kB]
Err:8 https://packages.gitlab.com/runner/gitlab-runner/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
Fetched 46.7 kB in 4s (10.6 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
6 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/gitlab/gitlab-ce/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
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 xenial 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/gitlab/gitlab-ce/ubuntu/dists/xenial/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/ubuntu/dists/xenial/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.

まあ、分かる人は分かると思うのですが、GitLabのパッケージの署名の鍵が更新されていて、このマシンに入っているパッケージの署名の鍵とアンマッチになっているのでエラーが出ています。

署名と鍵については、以下のページをご参照ください。
暗号化/復号と電子署名
https://lecture.ecc.u-tokyo.ac.jp/johzu/joho/Y2017/GNUPrivacyGuard/GNUPrivacyGuard/gpg_2.html

1. パッケージ取得の流れ

1-1. 通常のパッケージ取得の流れ

image.png

1-2. 現在のパッケージ取得の流れ

image.png

3. 解消方法

解消方法は、簡単で新しい鍵を入れればOKです。

Cryptographic details related to omnibus-gitlab packages | GitLab
https://docs.gitlab.com/omnibus/update/package_signatures.html#fetching-new-keys-after-2020-04-06

やってみましょう。

xxx@gitlab:~$ curl https://packages.gitlab.com/gpg.key -o /tmp/omnibus_gitlab_gpg.key
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3191  100  3191    0     0   3144      0  0:00:01  0:00:01 --:--:--  3146
xxx@gitlab:~$ sudo apt-key add /tmp/omnibus_gitlab_gpg.key
[sudo] user のパスワード:
OK

鍵を入れました。

xxx@gitlab:~/bin# sudo apt update
ヒット:1 https://download.docker.com/linux/ubuntu xenial InRelease
ヒット:2 http://security.ubuntu.com/ubuntu xenial-security InRelease                          
ヒット:3 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial InRelease
ヒット:4 https://packages.gitlab.com/gitlab/gitlab-ee/ubuntu xenial InRelease
ヒット:5 https://packages.gitlab.com/runner/gitlab-runner/ubuntu xenial InRelease
ヒット:6 http://jp.archive.ubuntu.com/ubuntu xenial InRelease
ヒット:7 http://jp.archive.ubuntu.com/ubuntu xenial-updates InRelease
ヒット:8 http://jp.archive.ubuntu.com/ubuntu xenial-backports InRelease
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了

エラーなくapt updateできました。

13
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
5