| Tested on | RHEL 10.2 (Coughlan) — vm1.lab.example |
|---|---|
| Package | rpm 4.19.1.1-23.el10.x86_64dnf 4.20.0-22.el10_2 |
| Applies to | RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, and Fedora with DNF or YUM-style package management |
| Privilege | sudo or root |
| Scope | Fix error: Failed dependencies on rpm install and erase with dnf install and dnf remove, list requirements with dnf repoquery, and install offline RPM bundles. Does not cover building custom RPMs or mirroring full repositories. |
| Related guides | Download RPM with all dependencies Complete RPM dependency list Local offline DNF repository DNF command Install EPEL |
error: Failed dependencies from rpm means a Requires rule is not satisfied — on install because a prerequisite package is missing, on erase because another installed package still depends on what you tried to remove. On RHEL family hosts the fix is usually dnf, not installing or erasing RPMs one file at a time.
This guide is RHEL family only (RHEL, Rocky Linux, AlmaLinux, Fedora, and related RPM distributions). Examples use gcc-c++ and libstdc++-devel on vm1.lab.example — reversible packages you can remove when you finish testing.
dnf install ./package.rpm on connected hosts and dnf install ./*.rpm (or a local repo) for offline bundles. Reserve rpm --nodeps for throwaway lab RPMs only.
What RPM Failed dependencies means
| Command | Typical error | What it means |
|---|---|---|
rpm -ivh package.rpm |
X is needed by package |
A Requires package is not installed yet |
rpm -e package |
X is needed by (installed) other-package |
Another installed RPM still Requires the package you tried to erase |
rpm reports the immediate problem and stops. DNF reads repository metadata, orders a transaction, and can install or remove multiple packages together.
Fix Failed dependencies when installing an RPM
On a connected host, point DNF at the local RPM file and let it pull missing dependencies from enabled repositories:
sudo dnf install ./gcc-c++-*.rpmSample output (trimmed):
Installing:
gcc-c++-14.3.1-4.4.el10.x86_64
Installing dependencies:
libstdc++-devel-14.3.1-4.4.el10.x86_64
Complete!That is the default fix when repositories work. DNF downloaded libstdc++-devel, satisfied the Requires chain, and installed both packages.
The same missing dependency is what rpm -ivh reports as libstdc++-devel = … is needed by gcc-c++-… — use dnf install ./package.rpm instead of installing dependency RPMs one file at a time.
Find missing dependencies
Before you copy RPMs to an air-gapped server, inspect what a package needs.
Direct resolved requirements
This lists packages that directly satisfy what gcc-c++ Requires — not every transitive dependency:
dnf repoquery --requires gcc-c++ --resolveSample output:
gcc-0:14.3.1-4.4.el10.x86_64
glibc-0:2.39-128.el10_2.x86_64
gmp-1:6.2.1-12.el10.x86_64
libmpc-0:1.3.1-7.el10.x86_64
libstdc++-0:14.3.1-4.4.el10.x86_64
libstdc++-devel-0:14.3.1-4.4.el10.x86_64
libzstd-0:1.5.5-9.el10.x86_64
mpfr-0:4.2.1-8.el10.x86_64
zlib-ng-compat-0:2.2.3-3.el10_1.x86_64Many entries may already be installed on the target. Use this view to see immediate gaps, not a full offline bundle list.
Recursive required dependencies
To recursively follow the package's Requires dependencies and their providers, add --recursive:
dnf repoquery --requires gcc-c++ --resolve --recursiveOn vm1.lab.example that query returned hundreds of packages (for example bash, coreutils, and binutils deep in the chain), while the direct query above listed nine resolved providers — useful when planning an offline bundle, though it still reflects required dependencies rather than every optional or weak dependency. For more listing tools and edge cases, see complete RPM dependency list.
Download everything you need with dnf download --resolve --alldeps as described in download RPM with all dependencies.
Install RPMs with dependencies offline
On a connected download host, pull the dependency tree into one directory:
mkdir -p ~/rpm-lab/failed-deps && cd ~/rpm-lab/failed-deps
dnf download --resolve --alldeps --downloaddir=. gcc-c++Copy that directory to the disconnected target. Red Hat documents that when repositories cannot supply dependencies, DNF must receive paths to the dependency RPMs as well — not only the top-level package file.
Install the whole bundle from the directory:
cd /path/to/rpm-bundle
sudo dnf install ./*.rpmDNF reads every RPM in the glob, resolves Requires across the set, and installs the transaction. Pointing it at ./package.rpm alone does not automatically pull in sibling RPM files sitting in the same folder.
Alternatively, run createrepo on the directory, add a file:// entry under /etc/yum.repos.d/, and install with dnf install package-name from that local repository — see local offline DNF repository.
Fix Failed dependencies when removing an RPM
rpm -e stops when another installed package still Requires what you tried to erase. After gcc-c++ and libstdc++-devel are installed, this fails:
rpm -e libstdc++-develSample output:
error: Failed dependencies:
libstdc++-devel = 14.3.1-4.4.el10 is needed by (installed) gcc-c++-14.3.1-4.4.el10.x86_64Use dnf remove when you intend to uninstall a package and anything that depends on it. Preview the transaction without applying it:
dnf remove --assumeno libstdc++-develSample output:
Removing:
libstdc++-devel
Removing dependent packages:
gcc-c++
Transaction Summary
Remove 2 Packages
Operation aborted.--assumeno prints the full plan and exits. A single rpm -e error line only named the first reverse dependency; DNF calculated the dependent removal chain.
When the preview looks correct, remove the same starting package and let DNF include dependents in the transaction:
sudo dnf remove libstdc++-develDNF prompts for confirmation and lists gcc-c++ among the packages to erase — you do not need to name every dependent package yourself. On production software, read that summary carefully; removing one library RPM can pull a long chain if you picked the wrong starting package.
Why you should avoid --nodeps
Older guides suggest rpm -e package --nodeps to ignore reverse dependencies. That drops the RPM database entry while other packages still expect those files on disk — a common path to a broken system.
This walkthrough never used --nodeps on gcc-c++, libstdc++-devel, or any RHEL platform package. Treat --nodeps as a last resort on custom or lab-only RPMs you built yourself, not on packages from BaseOS, AppStream, or EPEL.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
rpm -ivh lists one missing package, then another on retry |
Manual one-by-one installs | Use dnf install ./package.rpm on connected hosts |
Offline dnf install ./foo.rpm still fails |
Dependency RPMs sit in the directory but were not passed to DNF | Run sudo dnf install ./*.rpm or configure a local offline repository |
dnf install ./foo.rpm fails with nothing provides on a connected host |
Disabled repo, wrong architecture, or EPEL missing | Enable required repos; match OS major version and CPU arch to the RPM |
rpm -e shows Failed dependencies |
Another installed RPM still Requires this package | Use dnf remove package and read the planned transaction |
dnf remove wants to erase many system packages |
Starting package is deep in the dependency graph | Cancel, preview with --assumeno, or stop using the software instead of forcing removal |
| Bundle still incomplete after download | Used --resolve without --alldeps or wrong OS on download host |
Re-download with dnf download --resolve --alldeps on a host matching the offline target |
References
- rpm(8) — RPM Package Manager
- dnf(8) — DNF package manager
- Red Hat Enterprise Linux 10 — Managing software with DNF
Summary
error: Failed dependencies means RPM's Requires rules are not met. On RHEL family systems, fix install errors with dnf install ./package.rpm when repositories work, or with sudo dnf install ./*.rpm (or a local repo) when dependencies exist only as files in an offline bundle — not by pointing DNF at the main RPM alone.
To plan that bundle, use dnf repoquery --requires --resolve for direct requirements and --recursive when you need the recursive Requires chain. For removal, rpm -e shows the first blocker; dnf remove package previews and executes the dependent chain — start from one package name, read the transaction, and avoid rpm --nodeps on platform software.

