Search My Techie Guy

Tuesday, July 15, 2014

GPG key retrieval failed - Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RHEL-6

Problem: Got this error while using yum install on Red Hat Enterprise Linux 6.2

# yum install ftp
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ftp.x86_64 0:0.17-51.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================================
 Package                                          Arch                                                Version                                                      Repository                                               Size
=================================================================================================================================================================================================================================
Installing:
 ftp                                              x86_64                                              0.17-51.1.el6                                                redhat-dvd                                               57 k

Transaction Summary
=================================================================================================================================================================================================================================
Install       1 Package(s)

Total download size: 57 k
Installed size: 95 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RHEL-6
GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RHEL-6

Solution:

Edit your repo files under: /etc/yum.repos.d
Make sure the repo file you are trying to use has the right gpgkey
For example, i was using the wrong gpgkey in this file:

# ls -ltr
total 20
-rw-r--r--. 1 root root   78 Jul 15 20:07 redhat.repo
-rw-r--r--. 1 root root  154 Jul 15 20:07 redhat-dvd.repo
-rw-r--r--. 1 root root  957 Nov  5  2012 epel.repo
-rw-r--r--. 1 root root 1056 Nov  5  2012 epel-testing.repo
-rw-r--r--. 1 root root  529 Nov  8  2011 rhel-source.repo

I compared with the gpgkey in rhel-source.repo and editted redhat-dvd.repo to have the same key as below:

# more redhat-dvd.repo 
[redhat-dvd]
name=RHEL-$releasever - dvd 
baseurl=file:///media/redhat-dvd
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release




No comments: