How to fix GPG key retrieval failed: [Errno 14]

repositoryrpm

I'm using Centos 6.5 and when I want to install packages from yum I get this error:

GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias

How can I fix this?

Best Answer

This error happens because you have some YUM repository configuration in /etc/yum.repos.d/ that lists a GPG key like this:

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias

This configuration is telling YUM that the GPG key for the repository exists on disk. The error you get from YUM is YUM letting you know that it couldn't find the GPG key at the path /etc/pki/rpm-gpg/RPM-GPG-KEY-puias

So, by manually writing the GPG key to /etc/pki/rpm-gpg/RPM-GPG-KEY-puias like you did, YUM was then able to find the key at that path.

Alternatively, you could have set gpgkey to the URL of the key, like this:

gpgkey=http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias

in you repository configuration.

GPG and YUM/RPM can be quite tricky. If you are curious about how more of the internals work, check out this blog post.

Related Question