error failed dependencies rpm install. install rpm with dependencies offline. Remove rpm offline with dependencies in Linux. install rpm centos 7 error failed dependencies. fedora install rpm error failed dependencies. yum install rpm with failed dependencies. yum remove rpm failed dependencies offline. How to install rpm with dependencies in Linux.
While installing or removing a rpm manually (without yum), you may get Failed dependencies error. It happens because a rpm requires certain pre-requisite rpms to be installed before installing the main rpm.
For example I am trying to install glibc-devel
here but the installation fails with Failed dependencies error. As it expected glibc-headers
to be installed before installing glibc-devel
on this Linux host.
[root@node1 ~]# rpm -ivh glibc-devel-2.17-260.el7_6.5.x86_64.rpm
error: Failed dependencies:
glibc-headers is needed by glibc-devel-2.17-260.el7_6.5.x86_64
glibc-headers = 2.17-260.el7_6.5 is needed by glibc-devel-2.17-260.el7_6.5.x86_64
Similarly while trying to remove another rpm I get similar error with failed dependencies, but we will discuss the removal part at the end of this article.
[root@node1 ~]# rpm -e pykickstart
error: Failed dependencies:
pykickstart >= 1.99.22 is needed by (installed) python-blivet-1:0.61.15.72-1.el7.noarch
pykickstart >= 1.99.66.19 is needed by (installed) anaconda-core-21.48.22.147-1.el7.centos.x86_64
Install rpm with dependencies
Now with the provided error on screen, it is not sure that this is the only dependency rpm which may be required for glibc-devel. You manually download this version of glibc-header (glibc-headers = 2.17-260.el7_6.5
) and then re-attempt the installation of glibc-devel
but it is also possible that the next time the rpm installation fails again for another dependency.
If you are lucky enough your rpm may get installed with only few dependencies but it is also possible that you end up downloading and installing tons of rpms as a dependency. This only frustrate you and eat up your time.
To avoid this you must create a local repo and install the primary and dependency rpms using yum. So the first thing we have to do is to get the list of dependency rpms for glibc-devel here.
Download dependency rpms
I have written another article with the steps to automatically locate and download all the dependency rpms.
/etc/yum.repos.d/
In this example we will use repotrack
to get the dependency list of rpms
repo-track
is part of yum-utils
so you can manually install this rpm if not installed already[root@node1 rpms]# repotrack glibc-devel Downloading basesystem-10.0-7.el7.centos.noarch.rpm Downloading bash-4.2.46-31.el7.x86_64.rpm Downloading ca-certificates-2018.2.22-70.0.el7_5.noarch.rpm Downloading centos-release-7-6.1810.2.el7.centos.x86_64.rpm Downloading chkconfig-1.7.4-1.el7.x86_64.rpm Downloading coreutils-8.22-23.el7.x86_64.rpm Downloading filesystem-3.2-25.el7.x86_64.rpm Downloading gawk-4.0.2-4.el7_3.1.x86_64.rpm Downloading glibc-2.17-260.el7_6.5.i686.rpm Downloading glibc-2.17-260.el7_6.5.x86_64.rpm Downloading glibc-common-2.17-260.el7_6.5.x86_64.rpm Downloading glibc-devel-2.17-260.el7_6.5.i686.rpm Downloading glibc-devel-2.17-260.el7_6.5.x86_64.rpm Downloading glibc-headers-2.17-260.el7_6.5.x86_64.rpm Downloading gmp-6.0.0-15.el7.i686.rpm Downloading gmp-6.0.0-15.el7.x86_64.rpm Downloading grep-2.20-3.el7.x86_64.rpm Downloading info-5.1-5.el7.x86_64.rpm Downloading kernel-headers-3.10.0-957.12.2.el7.x86_64.rpm Downloading keyutils-libs-1.5.8-3.el7.i686.rpm Downloading keyutils-libs-1.5.8-3.el7.x86_64.rpm Downloading krb5-libs-1.15.1-37.el7_6.x86_64.rpm Downloading libacl-2.2.51-14.el7.x86_64.rpm Downloading libattr-2.4.46-13.el7.x86_64.rpm Downloading libcap-2.22-9.el7.x86_64.rpm Downloading libcom_err-1.42.9-13.el7.x86_64.rpm Downloading libffi-3.0.13-18.el7.i686.rpm Downloading libffi-3.0.13-18.el7.x86_64.rpm Downloading libgcc-4.8.5-36.el7_6.2.i686.rpm Downloading libgcc-4.8.5-36.el7_6.2.x86_64.rpm Downloading libselinux-2.5-14.1.el7.x86_64.rpm Downloading libsepol-2.5-10.el7.x86_64.rpm Downloading libstdc++-4.8.5-36.el7_6.2.i686.rpm Downloading libstdc++-4.8.5-36.el7_6.2.x86_64.rpm Downloading libtasn1-4.10-1.el7.i686.rpm Downloading libtasn1-4.10-1.el7.x86_64.rpm Downloading libverto-0.2.5-4.el7.x86_64.rpm Downloading ncurses-5.9-14.20130511.el7_4.x86_64.rpm Downloading ncurses-base-5.9-14.20130511.el7_4.noarch.rpm Downloading ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm Downloading nspr-4.19.0-1.el7_5.i686.rpm Downloading nspr-4.19.0-1.el7_5.x86_64.rpm Downloading nss-softokn-freebl-3.36.0-5.el7_5.i686.rpm Downloading nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm Downloading nss-util-3.36.0-1.1.el7_6.i686.rpm Downloading nss-util-3.36.0-1.1.el7_6.x86_64.rpm Downloading openssl-libs-1.0.2k-16.el7_6.1.x86_64.rpm Downloading p11-kit-0.23.5-3.el7.i686.rpm Downloading p11-kit-0.23.5-3.el7.x86_64.rpm Downloading p11-kit-trust-0.23.5-3.el7.x86_64.rpm Downloading p11-kit-trust-0.23.5-3.el7.i686.rpm Downloading pcre-8.32-17.el7.x86_64.rpm Downloading pcre-8.32-17.el7.i686.rpm Downloading popt-1.13-16.el7.x86_64.rpm Downloading sed-4.2.2-5.el7.x86_64.rpm Downloading setup-2.8.71-10.el7.noarch.rpm Downloading tzdata-2019a-1.el7.noarch.rpm Downloading zlib-1.2.7-18.el7.x86_64.rpm
List the dependency rpms
Now if you do not have a node with active internet connection and baseline repository then you can also get the list of dependency rpms offline.
For the sake of this article I have used repoquery
command as it gives a very clear output with the rpm name and this can be used offline as well.
[root@node1 rpms]# repoquery -R --resolve --recursive glibc-devel pcre-0:8.32-17.el7.x86_64 kernel-headers-0:3.10.0-957.el7.x86_64 bash-0:4.2.46-31.el7.x86_64 glibc-headers-0:2.17-260.el7_6.5.x86_64 basesystem-0:10.0-7.el7.centos.noarch libacl-0:2.2.51-14.el7.x86_64 glibc-0:2.17-260.el7_6.5.i686 zlib-0:1.2.7-18.el7.x86_64 libgcc-0:4.8.5-36.el7_6.1.i686 libverto-0:0.2.5-4.el7.x86_64 grep-0:2.20-3.el7.x86_64 openssl-libs-1:1.0.2k-16.el7_6.1.x86_64 libselinux-0:2.5-14.1.el7.x86_64 nspr-0:4.19.0-1.el7_5.i686 nspr-0:4.19.0-1.el7_5.x86_64 ca-certificates-0:2018.2.22-70.0.el7_5.noarch ncurses-base-0:5.9-14.20130511.el7_4.noarch nss-util-0:3.36.0-1.1.el7_6.x86_64 ncurses-libs-0:5.9-14.20130511.el7_4.x86_64 libcap-0:2.22-9.el7.x86_64 filesystem-0:3.2-25.el7.x86_64 nss-util-0:3.36.0-1.el7_5.i686 p11-kit-0:0.23.5-3.el7.i686 keyutils-libs-0:1.5.8-3.el7.i686 info-0:5.1-5.el7.x86_64 chkconfig-0:1.7.4-1.el7.x86_64 centos-release-0:7-6.1810.2.el7.centos.x86_64 keyutils-libs-0:1.5.8-3.el7.x86_64 gmp-1:6.0.0-15.el7.i686 p11-kit-0:0.23.5-3.el7.x86_64 libgcc-0:4.8.5-36.el7.x86_64 tzdata-0:2018e-3.el7.noarch setup-0:2.8.71-10.el7.noarch popt-0:1.13-16.el7.x86_64 p11-kit-trust-0:0.23.5-3.el7.x86_64 libsepol-0:2.5-10.el7.x86_64 libcom_err-0:1.42.9-13.el7.x86_64 glibc-common-0:2.17-260.el7.x86_64 krb5-libs-0:1.15.1-34.el7.x86_64 nss-softokn-freebl-0:3.36.0-5.el7_5.x86_64 gmp-1:6.0.0-15.el7.x86_64 libtasn1-0:4.10-1.el7.x86_64 pcre-0:8.32-17.el7.i686 ncurses-0:5.9-14.20130511.el7_4.x86_64 coreutils-0:8.22-23.el7.x86_64 libffi-0:3.0.13-18.el7.i686 libstdc++-0:4.8.5-36.el7.x86_64 gawk-0:4.0.2-4.el7_3.1.x86_64 p11-kit-trust-0:0.23.5-3.el7.i686 glibc-0:2.17-260.el7_6.4.x86_64 libffi-0:3.0.13-18.el7.x86_64 sed-0:4.2.2-5.el7.x86_64 libattr-0:2.4.46-13.el7.x86_64
glibc-devel
.Below are the current list of repositories on my Linux node
[root@node1 rpms]# yum repolist Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.excellmedia.net * epel: repos.del.extreme-ix.org * extras: centos.excellmedia.net * openstack-stein: centos.excellmedia.net * updates: centos.excellmedia.net repo id repo name status base/7/x86_64 CentOS-7 - Base 10,019 *epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,221 extras/7/x86_64 CentOS-7 - Extras 409 openstack-stein/7/x86_64 OpenStack Stein Repository 1,804 rdo-qemu-ev/x86_64 RDO CentOS-7 - QEMU EV 75 updates/7/x86_64 CentOS-7 - Updates 1,982 repolist: 27,510
Create a customised repo
Install createrepo
rpm if not already installed
[root@node1 rpms]# rpm -qa | grep createrepo
Since I don't have a createrepo
rpm installed, I will install it via yum
[root@node1 rpms]# yum -y install creatrepo
Once you have downloaded all the rpms, next create a repo using createrepo
rpm. For the same of this article I have downloaded all my dependency rpms inside /root/rpms
.
Navigate inside the directory which contains all the downloaded dependency rpms
[root@node1 ~]# cd /root/rpms
createrepo /root/rpms/
.Next create the repo using below command
[root@node1 rpms]# createrepo . Spawning worker 0 with 58 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete
Our repo is created successfully. You can validate this, now a new repodata
directory must have been created under /root/rpms
.
[root@node1 rpms]# ls -l repodata total 280 -rw-r--r-- 1 root root 75853 Jun 3 13:00 11e8d76238ff21f69afdfaace67dd0b381d53ea6f50eabc696344dbb975ee9cb-filelists.xml.gz -rw-r--r-- 1 root root 27064 Jun 3 13:00 225d4da1642be7d9a07567d6ab5f82b6679b5949dbb1158278705f09fda59343-other.xml.gz -rw-r--r-- 1 root root 45925 Jun 3 13:00 5bf9d5a29b34070dbca033329f65bd28d33135fcd6719d518fb2e8f7be881d37-primary.sqlite.bz2 -rw-r--r-- 1 root root 35572 Jun 3 13:00 60a9bb4940ec7ee4d4cd45b4b83d941f73c155c56f539505f510c1b17fbd1f7e-other.sqlite.bz2 -rw-r--r-- 1 root root 65495 Jun 3 13:00 9ee15ecc9bf5b76ac799022ab7d90acf6d9044a3d79f88743903fc1d063dcab8-filelists.sqlite.bz2 -rw-r--r-- 1 root root 20804 Jun 3 13:00 cd4cf779c31707d754dc77773f943c49593c0324537a1773125355e4b6ad29df-primary.xml.gz -rw-r--r-- 1 root root 2988 Jun 3 13:00 repomd.xml [root@node1 rpms]# ls -ld repodata drwxr-xr-x 2 root root 4096 Jun 3 13:00 repodata
Create a repository file with below content. Modify the baseurl
with the location as per your environment. Since I have placed my rpms and created the repository inside /root/rpms
hence I have used the same.
[root@node1 rpms]# cat /etc/yum.repos.d/glibc-install.repo [glibc-rpms] name=glibc rpms baseurl=file:///root/rpms/ enabled=1 gpgcheck=0
Now for this article I want to make sure only one of my repo is used to install rpm i.e. glibc-devel
. Hence I have disabled all of my other repositories and have only enable glibc-rpms
repo in the below command to list the available rpms.
[root@node1 rpms]# yum --disablerepo="*" --enablerepo=glibc-rpms list available Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Available Packages glibc.i686 2.17-260.el7_6.5 glibc-rpms glibc-devel.i686 2.17-260.el7_6.5 glibc-rpms gmp.i686 1:6.0.0-15.el7 glibc-rpms keyutils-libs.i686 1.5.8-3.el7 glibc-rpms libffi.i686 3.0.13-18.el7 glibc-rpms libgcc.i686 4.8.5-36.el7_6.2 glibc-rpms libstdc++.i686 4.8.5-36.el7_6.2 glibc-rpms libtasn1.i686 4.10-1.el7 glibc-rpms nspr.i686 4.19.0-1.el7_5 glibc-rpms nss-softokn-freebl.i686 3.36.0-5.el7_5 glibc-rpms nss-util.i686 3.36.0-1.1.el7_6 glibc-rpms p11-kit.i686 0.23.5-3.el7 glibc-rpms p11-kit-trust.i686 0.23.5-3.el7 glibc-rpms pcre.i686 8.32-17.el7 glibc-rpms
Now in a similar way we will install rpm glibc-devel
by disabling all other repos except glibc-rpms
repository.
[root@node1 rpms]# yum --disablerepo="*" --enablerepo=glibc-rpms install glibc-devel Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package glibc-devel.x86_64 0:2.17-260.el7_6.5 will be installed --> Processing Dependency: glibc-headers = 2.17-260.el7_6.5 for package: glibc-devel-2.17-260.el7_6.5.x86_64 --> Processing Dependency: glibc-headers for package: glibc-devel-2.17-260.el7_6.5.x86_64 --> Running transaction check ---> Package glibc-headers.x86_64 0:2.17-260.el7_6.5 will be installed --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-260.el7_6.5.x86_64 --> Processing Dependency: kernel-headers for package: glibc-headers-2.17-260.el7_6.5.x86_64 --> Running transaction check ---> Package kernel-headers.x86_64 0:3.10.0-957.12.2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================== Package Arch Version Repository Size ======================================================================================== Installing: glibc-devel x86_64 2.17-260.el7_6.5 glibc-rpms 1.1 M Installing for dependencies: glibc-headers x86_64 2.17-260.el7_6.5 glibc-rpms 683 k kernel-headers x86_64 3.10.0-957.12.2.el7 glibc-rpms 8.0 M Transaction Summary ======================================================================================== Install 1 Package (+2 Dependent packages) Total download size: 9.7 M Installed size: 6.9 M Is this ok [y/d/N]: y Downloading packages: ---------------------------------------------------------------------------------------- Total 134 MB/s | 9.7 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : kernel-headers-3.10.0-957.12.2.el7.x86_64 1/3 Installing : glibc-headers-2.17-260.el7_6.5.x86_64 2/3 Installing : glibc-devel-2.17-260.el7_6.5.x86_64 3/3 Verifying : glibc-headers-2.17-260.el7_6.5.x86_64 1/3 Verifying : kernel-headers-3.10.0-957.12.2.el7.x86_64 2/3 Verifying : glibc-devel-2.17-260.el7_6.5.x86_64 3/3 Installed: glibc-devel.x86_64 0:2.17-260.el7_6.5 Dependency Installed: glibc-headers.x86_64 0:2.17-260.el7_6.5 kernel-headers.x86_64 0:3.10.0-957.12.2.el7 Complete!
As you see with this trick we were successfully able to install our glibc-devel
rpm along with all the dependency rpms.
Remove rpm with dependencies
Now since we have a solution to install rpm with dependencies, let us understand the risks of removing rpm with dependencies.
It is very much possible that every time you try to remove or uninstall a rpm, you get "error: failed dependencies". Now here you have two choice with you
- Remove rpm along with it's dependencies
- Skip the dependency rpms and just remove the primary rpm which you wish to be un-installed
This choice completely depends on the type of rpm and list of dependency rpms. For most rpms like the one I have shown in my example, I see few rpms as dependency so I can choose to ignore the dependencies and just proceed with the offline removal of pykickstart rpm as I know the dependency rpms are required and will not impact my running system.
Remove rpm offline by skipping dependencies
Now you can remove rpm by skipping all the dependencies by using --nodeps
[root@node1 ~]# rpm -e pykickstart
error: Failed dependencies:
pykickstart >= 1.99.22 is needed by (installed) python-blivet-1:0.61.15.72-1.el7.noarch
pykickstart >= 1.99.66.19 is needed by (installed) anaconda-core-21.48.22.147-1.el7.centos.x86_64
[root@node1 ~]# rpm -e pykickstart --nodeps
Now let us validate if the rpm is successfully removed.
[root@node1 ~]# rpm -qa | grep pykickstart [root@node1 ~]#
So the rpm is removed while the dependencies are still present on my Linux node, as you can see below:
[root@kerberos ~]# rpm -qa | grep python-blivet python-blivet-0.61.15.72-1.el7.noarch [root@kerberos ~]# rpm -qa | grep anaconda-core anaconda-core-21.48.22.147-1.el7.centos.x86_64
Remove rpm with dependencies using yum
Now if you wish to remove rpm along with all the dependencies then you can use yum.
To remove rpm along with it's dependencies you can use the below command
[root@kerberos ~]# yum remove pykickstart
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package pykickstart.noarch 0:1.99.66.19-2.el7 will be erased
--> Processing Dependency: pykickstart >= 1.99.22 for package: 1:python-blivet-0.61.15.72-1.el7.noarch
--> Processing Dependency: pykickstart >= 1.99.66.19 for package: anaconda-core-21.48.22.147-1.el7.centos.x86_64
--> Running transaction check
---> Package anaconda-core.x86_64 0:21.48.22.147-1.el7.centos will be erased
--> Processing Dependency: anaconda-core = 21.48.22.147-1.el7.centos for package: anaconda-gui-21.48.22.147-1.el7.centos.x86_64
--> Processing Dependency: anaconda-core = 21.48.22.147-1.el7.centos for package: anaconda-tui-21.48.22.147-1.el7.centos.x86_64
---> Package python-blivet.noarch 1:0.61.15.72-1.el7 will be erased
--> Running transaction check
---> Package anaconda-gui.x86_64 0:21.48.22.147-1.el7.centos will be erased
--> Processing Dependency: anaconda-gui >= 21.48.22.102 for package: initial-setup-gui-0.3.9.43-1.el7.centos.x86_64
---> Package anaconda-tui.x86_64 0:21.48.22.147-1.el7.centos will be erased
--> Processing Dependency: anaconda-tui >= 21.48.22.102 for package: initial-setup-0.3.9.43-1.el7.centos.x86_64
--> Running transaction check
---> Package initial-setup.x86_64 0:0.3.9.43-1.el7.centos will be erased
---> Package initial-setup-gui.x86_64 0:0.3.9.43-1.el7.centos will be erased
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================
Removing:
pykickstart noarch 1.99.66.19-2.el7 @base 1.7 M
Removing for dependencies:
anaconda-core x86_64 21.48.22.147-1.el7.centos @anaconda 8.1 M
anaconda-gui x86_64 21.48.22.147-1.el7.centos @anaconda 1.5 M
anaconda-tui x86_64 21.48.22.147-1.el7.centos @anaconda 443 k
initial-setup x86_64 0.3.9.43-1.el7.centos @anaconda 221 k
initial-setup-gui x86_64 0.3.9.43-1.el7.centos @anaconda 32 k
python-blivet noarch 1:0.61.15.72-1.el7 @anaconda 3.0 M
Transaction Summary
===============================================================================================================================
Remove 1 Package (+6 Dependent packages)
Installed size: 15 M
Is this ok [y/N]: y <- Press "y" for confirmation
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : initial-setup-gui-0.3.9.43-1.el7.centos.x86_64 1/7
Erasing : anaconda-gui-21.48.22.147-1.el7.centos.x86_64 2/7
Erasing : initial-setup-0.3.9.43-1.el7.centos.x86_64 3/7
Erasing : anaconda-core-21.48.22.147-1.el7.centos.x86_64 4/7
Erasing : anaconda-tui-21.48.22.147-1.el7.centos.x86_64 5/7
Erasing : 1:python-blivet-0.61.15.72-1.el7.noarch 6/7
Erasing : pykickstart-1.99.66.19-2.el7.noarch 7/7
Verifying : anaconda-tui-21.48.22.147-1.el7.centos.x86_64 1/7
Verifying : 1:python-blivet-0.61.15.72-1.el7.noarch 2/7
Verifying : anaconda-core-21.48.22.147-1.el7.centos.x86_64 3/7
Verifying : initial-setup-gui-0.3.9.43-1.el7.centos.x86_64 4/7
Verifying : pykickstart-1.99.66.19-2.el7.noarch 5/7
Verifying : initial-setup-0.3.9.43-1.el7.centos.x86_64 6/7
Verifying : anaconda-gui-21.48.22.147-1.el7.centos.x86_64 7/7
Removed:
pykickstart.noarch 0:1.99.66.19-2.el7
Dependency Removed:
anaconda-core.x86_64 0:21.48.22.147-1.el7.centos anaconda-gui.x86_64 0:21.48.22.147-1.el7.centos
anaconda-tui.x86_64 0:21.48.22.147-1.el7.centos initial-setup.x86_64 0:0.3.9.43-1.el7.centos
initial-setup-gui.x86_64 0:0.3.9.43-1.el7.centos python-blivet.noarch 1:0.61.15.72-1.el7
Complete!
Now you must be wondering, why yum shows a larger list of dependency rpms compared to STDERR while doing rpm -e pykickstart
?
While doing rpm -e <rpm_name>
, the rpm command shows dependency list for the provided rpm. Now before attempting to remove rpm, yum will locate the dependency list of the dependency rpms i.e. for example anaconda-core is a dependency for pykickstart
but then anaconda-tui
is a dependency for anaconda-core
. Hence the entire chain must be removed.
This is the reason why we strongly recommend "NOT TO" use yum
for removing rpms with dependencies.
Lastly I hope the steps from the article to remove rpm or install rpm along with dependency rpms (fixing failed dependencies) was helpful. So, let me know your suggestions and feedback using the comment section.
This is my first time I have visited your site. I found a lot of interesting stuff in your blog. From the tons of comments on your posts, I guess I am not the only one! keep up the good work.