RPM: Failed Dependencies Error

(Open Source Rebuild Series)

1 Overview

The rpm failed dependencies error occurs when we install a rpm which requires another rpm which is not installed in the system.

$ rpm --install /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm
error: Failed dependencies:
        tree is needed by banner-1.3.6-1.fc44.aarch64

2 Setup Lab

3 Reproduce

Step 1: Edit spec file to let banner rpm depend on tree rpm.

cont$ cd ~/banner
cont$ tree
.
├── banner-1.3.6.tar.gz
└── banner.spec

cont$ vi banner.spec
# -------------------- #
...
Requires:       tree
...
# -------------------- #

Step 2: Build banner rpm.

cont$ rpmbuild -bp banner.spec

cont$ rpmbuild -bb --noprep --noclean banner.spec
Wrote: /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm

Step 3: Check dependencies of banner rpm.

cont$ rpm -qR /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm
ld-linux-aarch64.so.1()(64bit)
ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)
libc.so.6()(64bit)
...
rtld(GNU_HASH)
tree

Step 4: Remove tree rpm which required by banner rpm.

cont$ rpm -qa | grep tree
tree-2.2.1-4.fc44.aarch64

cont$ rpm --erase tree-2.2.1-4.fc44.aarch64

Step 5: Install banner rpm.

cont$ rpm --install /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm
error: Failed dependencies:
        tree is needed by banner-1.3.6-1.fc44.aarch64

4 Trick: RpmRebuild

In case we don’t have the source to rebuild the banner rpm, we can modify the final rpm using rpmrebuild, remove the failed dependencies.

Step 1: Install rpmbuild.

cont$ dnf install rpmrebuild

Step 2: Remove the failed dependencies.

cont$ rpmrebuild -enp /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm
# -------------------- #
Requires:      ld-linux-aarch64.so.1()(64bit)
Requires:      ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)
Requires:      libc.so.6()(64bit)
Requires:      rtld(GNU_HASH)
#Requires:      tree
# -------------------- #

Step 3: Check dependencies.

cont$ rpm -qR /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm
ld-linux-aarch64.so.1()(64bit)
ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)
libc.so.6()(64bit)
...
rtld(GNU_HASH)

Step 4: Install the banner rpm.

cont$ rpm --install /root/rpmbuild/RPMS/aarch64/banner-1.3.6-1.fc44.aarch64.rpm

The banner rpm does not require tree rpm anymore, so we can proceed with the installation.

5 Solution: Install Needed Packages

Install tree rpm which is required by banner rpm.

cont$ dnf install tree

6 References