Search code examples
linuxstreamcentos

Failed to download metadata for repository 'pgdg-common' on CentOS 7


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

Solution

  • 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.