6
0

[PostgreSQL]Error: Failed to download metadata for repo 'pgdg-centos8-sysupdates': repomd.xml GPG signature verification error: Bad GPG signature

Last updated at Posted at 2024-01-11

Error: Failed to download metadata for repo 'pgdg-centos8-sysupdates': repomd.xml GPG signature verification error: Bad GPG signature

2024年1月11日時点の情報です。

dnf updateを実行した際に、Bad GPG signatureエラーが発生しpgdg-commonのメタデータのダウンロードに失敗しました。

# dnf update
PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                          396  B/s | 659  B     00:01
PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                          1.6 MB/s | 1.7 kB     00:00
PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                          397  B/s | 659  B     00:01
Error: Failed to download metadata for repo 'pgdg-common': repomd.xml GPG signature verification error: Bad GPG signature

Red Hatのフォーラムによると、pgdg-redhat-repo-42.0-38PGDG.noarch.rpmに更新すれば問題が解決する可能性があることがわかりました。

現在インストールされているpgdg-redhat-repoのバージョンを確認しました。

# rpm -qa | grep pgdg
pgdg-redhat-repo-42.0-35PGDG.noarch

現在のバーションは42.0-35ですので、これを42.0-38にアップデートすることにしました。

PostgreSQLのリポジトリを確認します。
image.png

pgdg-redhat-repo-42.0-38PGDG.noarch.rpmを見つけました。
パッケージをダウンロードしてインストールしましたが、同じエラーが再度発生しました。

# wget https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-8.9-x86_64/pgdg-redhat-repo-42.0-38PGDG.noarch.rpm
[中略]
2024-01-11 07:57:56 (433 MB/s) - ‘pgdg-redhat-repo-42.0-38PGDG.noarch.rpm’ saved [14552/14552]

# ls
pgdg-redhat-repo-42.0-38PGDG.noarch.rpm
# yum localinstall pgdg-redhat-repo-42.0-38PGDG.noarch.rpm
PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                          406  B/s | 659  B     00:01
PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                          1.6 MB/s | 1.7 kB     00:00
PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                          408  B/s | 659  B     00:01
Error: Failed to download metadata for repo 'pgdg-common': repomd.xml GPG signature verification error: Bad GPG signature

そこで、GPGシグネチャの検証を一時的に無効にするために pgdg-redhat-all.repoファイルを編集しました。

# emacs /etc/yum.repos.d/pgdg-redhat-all.repo
[pgdg-common]
name=PostgreSQL common RPMs for RHEL / Rocky $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-$releasever-$basearch
- enabled=1
+ enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg-centos8-sysupdates]
name=PostgreSQL Supplementary ucommon RPMs for RHEL / Rocky $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/common/pgdg-centos8-sysupdates/redhat/rhel-$releasever-$basearch
- enabled=1
+ enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1

[pgdg15]
name=PostgreSQL 15 for RHEL / Rocky $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-$releasever-$basearch
- enabled=1
+ enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
repo_gpgcheck = 1
exclude=pgpool*

この変更後に、再度 yum localinstallを実行しました。

# yum localinstall pgdg-redhat-repo-42.0-38PGDG.noarch.rpm
[中略]
Running transaction
  Preparing        :                                                                                                    1/1
  Upgrading        : pgdg-redhat-repo-42.0-38PGDG.noarch                                                                1/2
warning: /etc/yum.repos.d/pgdg-redhat-all.repo created as /etc/yum.repos.d/pgdg-redhat-all.repo.rpmnew

  Cleanup          : pgdg-redhat-repo-42.0-35PGDG.noarch                                                                2/2
  Verifying        : pgdg-redhat-repo-42.0-38PGDG.noarch                                                                1/2
  Verifying        : pgdg-redhat-repo-42.0-35PGDG.noarch                                                                2/2

Upgraded:
  pgdg-redhat-repo-42.0-38PGDG.noarch

Complete!

無事インストールできましたので、pgdg-redhat-all.repo.rpmnewファイルを現在のpgdg-redhat-all.repoファイルと置き換えました。
差し替える前にpgdg-redhat-all.repoの内容にあわせて、pgdg-redhat-all.repo.rpmnewを編集しました。

# emacs pgdg-redhat-all.repo.rpmnew
# mv pgdg-redhat-all.repo pgdg-redhat-all.repo.bak
# cp pgdg-redhat-all.repo.rpmnew pgdg-redhat-all.repo

最後に、dnf updateを再度実行し、GPGシグネチャの検証エラーが解消されたことを確認しました。

# dnf update
PostgreSQL common RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64                              408  B/s | 659  B     00:01
PostgreSQL common RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64                              2.4 MB/s | 2.4 kB     00:00
Importing GPG key 0x08B40D20:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Is this ok [y/N]: y
PostgreSQL common RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64                              410  B/s | 659  B     00:01
PostgreSQL common RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64                              207 kB/s | 793 kB     00:03
PostgreSQL Supplementary ucommon RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64               413  B/s | 659  B     00:01
PostgreSQL Supplementary ucommon RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64               2.4 MB/s | 2.4 kB     00:00
Importing GPG key 0x08B40D20:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Is this ok [y/N]: y
PostgreSQL Supplementary ucommon RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64               405  B/s | 659  B     00:01
PostgreSQL Supplementary ucommon RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64               119 kB/s | 420 kB     00:03
PostgreSQL 16 for RHEL / Rocky / AlmaLinux 8 - x86_64                                       416  B/s | 659  B     00:01
PostgreSQL 16 for RHEL / Rocky / AlmaLinux 8 - x86_64                                       2.4 MB/s | 2.4 kB     00:00
Importing GPG key 0x08B40D20:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Is this ok [y/N]: y
PostgreSQL 16 for RHEL / Rocky / AlmaLinux 8 - x86_64                                        72 kB/s | 233 kB     00:03
PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8 - x86_64                                       409  B/s | 659  B     00:01
PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8 - x86_64                                       2.4 MB/s | 2.4 kB     00:00
Importing GPG key 0x08B40D20:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Is this ok [y/N]: y
PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8 - x86_64                                       393  B/s | 659  B     00:01
PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8 - x86_64                                       106 kB/s | 476 kB     00:04
Dependencies resolved.
6
0
1

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
6
0