In this article, it will be described several cases where the installation of a package or certain utility failed because of the gpg key problem. Below are those cases :
1. The gpg key entry defined in the repository files located in /etc/yum.repos.d are different with the operating system running. Below is one of the case found :
The entry found in CentOS-Base.repo as one of the file used for defining CentOS repository concerning the gpg key :
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
But it turns out in the reality the version of the operating system is CentOS 7. So, it will trigger the following error which will failed the installation package as shown below :
[root@hostname yum.repos.d]# yum -y install wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-13.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================================================== Installing: wget x86_64 1.14-13.el7 base 546 k Transaction Summary ===================================================================================================================================================================================================================== Install 1 Package Total download size: 546 k Installed size: 2.0 M Downloading packages: warning: /var/cache/yum/x86_64/7/base/packages/wget-1.14-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY ] 0.0 B/s | 0 B --:--:-- ETA Public key for wget-1.14-13.el7.x86_64.rpm is not installed wget-1.14-13.el7.x86_64.rpm | 546 kB 00:00:00 Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 Importing GPG key 0xE8562897: Userid : "CentOS-5 Key (CentOS 5 Official Signing Key) <[email protected]>" Fingerprint: 473d 66d5 2122 71fd 51cc 17b1 a8a4 47dc e856 2897 From : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 Public key for wget-1.14-13.el7.x86_64.rpm is not installed Failing package is: wget-1.14-13.el7.x86_64 GPG Keys are configured as: http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 [root@hostname yum.repos.d]#
As shown in the above output there is a Failing package which is wget-1.14-13.el7.x86_64 because the Public key for the package itself is not installed since the GPG Keys configured are for CentOS 5 specified in the repository file is http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5. Whereas the version of the operating system of the server running is CentOS 7 as shown below :
[root@centos yum.repos.d]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@centos yum.repos.d]#
2. The file which is specified as the gpg key which is assumed exist locally is not available as specified in the repository file. The entry on the repository file concerning local gpg key is shown below :
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Below is the proof of the existance of the file :
[root@centos rpm-gpg]# ls RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Debug-7 RPM-GPG-KEY-CentOS-Testing-7 [root@centos rpm-gpg]#
Although the file maybe exist as show above, if there is a warning showed because of the signature of the gpg key which in the end failed the installation package as shown in the following package installation :
[root@hostname yum.repos.d]# yum -y install wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-13.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================================================== Installing: wget x86_64 1.14-13.el7 base 546 k Transaction Summary ===================================================================================================================================================================================================================== Install 1 Package Total download size: 546 k Installed size: 2.0 M Downloading packages: warning: /var/cache/yum/x86_64/7/base/packages/wget-1.14-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for wget-1.14-13.el7.x86_64.rpm is not installed wget-1.14-13.el7.x86_64.rpm | 546 kB 00:00:00 Public key for wget-1.14-13.el7.x86_64.rpm is not installed [root@hostname yum.repos.d]#
The solution for the above problem is to disabled gpg-key in the repository file definition entry as shown below :
gpgcheck=0
Run the installation package again, if nothing else goes wrong, the installation package will be succeeded.
One thought on “Failed to install package because of gpg key”