Failed to download metadata for repository 'pgdg-common' on CentOS 7 [closed]
Asked Answered
B

7

16

When I try to install or update packages on my CentOS Stream 8, then this error occurs:

cd ~
sudo yum update

Output:

PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64                                                           613  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                                                           503  B/s | 659  B     00:01

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

I tried to install Docker or just update the packages or libraries on my CentOS 7 server.

Server details

cd ~
hostnamectl

Output:

   Static hostname: e2e-101-138
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 7bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
           Boot ID: c0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Virtualization: kvm
  Operating System: CentOS Stream 8
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-529.el8.x86_64
      Architecture: x86-64
Bestow answered 8/1 at 19:7 Comment(0)
P
19

You can try:

rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

But for me, this didn't fix the issue. Until a proper solution is found, for me, renaming the following file worked:

cd /etc/yum.repos.d/
mv pgdg-redhat-all.repo pgdg-redhat-all.repo.old
yum update -y

At the very least, it should let you install and update packages now.

Parthia answered 9/1 at 12:10 Comment(2)
Thanks, your solution works. Is this going to occupy more storage, like my old packages and new ones are both on the system? If yes then how do I clean?Bestow
2nd solution works fine with me too. thnxClearance
A
22

Reference

For CentOS 7:

yum --disablerepo=* -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Americanist answered 9/1 at 15:34 Comment(2)
After installing the new repository package (as per the answer) you can automatically accept the new keys using (for example): yum -y list updatesTemplin
Thank you, but in my case, this solution won't workBestow
P
19

You can try:

rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

But for me, this didn't fix the issue. Until a proper solution is found, for me, renaming the following file worked:

cd /etc/yum.repos.d/
mv pgdg-redhat-all.repo pgdg-redhat-all.repo.old
yum update -y

At the very least, it should let you install and update packages now.

Parthia answered 9/1 at 12:10 Comment(2)
Thanks, your solution works. Is this going to occupy more storage, like my old packages and new ones are both on the system? If yes then how do I clean?Bestow
2nd solution works fine with me too. thnxClearance
P
8

I am seeing this issue on Rocky Linux 8 VMs too.

Our puppet runs started complaining about the signature of the repository download early on 2024-01-05.

This was the issue for us along with the solution (for us at least):

Provocation answered 9/1 at 11:11 Comment(0)
M
3

The repository URL may be broken.

For CentOS 7:

Run:

sudo rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Then:

yum update -y
Myeshamyhre answered 9/1 at 6:10 Comment(1)
still the error is here .... Importing GPG key 0x73E3B907: Userid : "PostgreSQL RPM Repository <[email protected]>" Fingerprint: F245 F0BF 96AC 1827 44CA FF2E 64FA CE11 73E3 B907 From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7 PostgreSQL common RPMs for RHEL / CentOS 8 - x86_64 Error: Failed to download metadata for repo 'pgdg-common': repomd.xml GPG signature verification error: Bad GPG signatureBestow
W
1

The top solution from spry worked on one system (Redhat 8.9) but not on another (Redhat 8.7), I just kept getting complaints from dnf:

Updating Subscription Management repositories. PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64 585 B/s | 659 B 00:01 PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64 0.0 B/s | 0 B
00:00 Errors during downloading metadata for repository 'pgdg-common':

  • Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG] Error: Failed to retrieve GPG key for repo 'pgdg-common': Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG]

To resolve, I just removed the pgdg-redhat-repo package (dnf remove pgdg-redhat-repo) and installed it again (dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm).

Wearproof answered 3/4 at 21:57 Comment(0)
O
0

I run Rocky 8 in both VMs and as a host. I tried spry's suggestion and followed the instructions in the link and it worked perfectly for me (thank you, spry). I'm providing it again here for convenience.

PostgreSQL RPM repository GPG key update - 3 January 2024

Note that there are a lot of dnf command lines provided for you in the PostgreSQL article in the section "TL;DR: How can update my keys?". Be sure to choose your version carefully.

Although I trust postresql.org, I still had concerns that the --disablerepo=* switch would affect other repos so I tested it in my VM first. I listed active repos with

dnf repolist

then ran the dnf command provided by postresql.org for Rocky 8. After it completed, I ran the repolist command again. All was well.

Oni answered 27/1 at 13:48 Comment(0)
P
0

clean the cache and delete the pgdg related files and re-install is ok

sudo dnf clean all
sudo rm -rf /var/cache/dnf/*pgdg*
Pragmaticism answered 23/3 at 2:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.