How to Fix DNF Broken Dependencies on Fedora

Fix DNF broken dependencies on Fedora by running distro-sync or clearing the package cache.

When DNF Refuses to Install or Upgrade

You run a routine package installation or system update and the terminal immediately halts. DNF prints a dependency resolution error and refuses to proceed. You need to apply security patches or install a development tool, but the package manager keeps citing missing libraries, version conflicts, or unsatisfied requirements. This scenario happens frequently after a partial upgrade, a third-party repository addition, a network interruption during metadata download, or a manual package installation that drifted from the default repository baseline. Your system feels locked, but the package manager is actually protecting you from a broken state.

What is actually happening under the hood

DNF does not simply download and unpack files. It builds a complete dependency graph before touching your disk. Every RPM package declares what it requires, what it provides, and what it conflicts with. When you request an action, DNF calculates a transaction that satisfies every constraint while preserving system stability. If the graph contains a circular dependency, a missing node, or a version mismatch, the solver aborts. Think of it like a mechanical assembly line. You request a finished engine. The engine requires a specific piston. The piston requires a specific alloy. If the alloy was discontinued last month, the entire assembly halts. DNF prevents you from installing half a system. The error is a safety mechanism. Your job is to give the solver the correct metadata so it can find a valid path.

Fedora updates its repositories constantly. Package versions shift. Metadata files grow. DNF caches this data locally to speed up operations and reduce bandwidth usage. Stale cache is the most common cause of phantom dependency errors. Always treat the local cache as a temporary snapshot, not the source of truth. The repository metadata on the server is the only authoritative record of what is available and how packages relate to each other.

Align your system with the repository baseline

Here is how to force DNF to recalculate the dependency graph against the latest repository state and realign your installed packages.

sudo dnf distro-sync
# --refresh forces a fresh metadata download before the solver runs
# distro-sync aligns installed packages with the default repository versions
# This replaces downgraded or manually installed packages with repo versions

The distro-sync command does more than upgrade. It synchronizes package versions to match the repository baseline. If you manually installed a newer version from a COPR repository or a third-party source, distro-sync will downgrade it to the official Fedora version. This is intentional. The official repositories are tested together. Third-party packages often pull in conflicting library versions that break the solver. Running this command untangles the graph by resetting your system to the known-good state maintained by the Fedora packaging team.

Use dnf upgrade --refresh for your weekly maintenance routine. It applies new versions without downgrading packages you intentionally kept. Reserve distro-sync for when the dependency graph is actually tangled. Reboot after a successful sync. Half the time the symptom disappears once the kernel and core libraries match.

Clear stale metadata and rebuild the cache

If the sync fails, your local metadata is likely corrupted or out of sync with the server. Network drops, disk space exhaustion, or interrupted downloads can leave DNF's internal databases in an inconsistent state.

sudo dnf clean all
# Removes cached RPM headers, metadata XML files, and SQLite databases
sudo dnf makecache
# Rebuilds the local metadata index from scratch using fresh server data

DNF stores repository information in SQLite databases and compressed XML files under /var/cache/dnf/. When a download cuts off mid-stream, the database can retain partial records. The solver then tries to match against incomplete data and fails. Cleaning the cache forces DNF to discard everything and fetch a clean copy. The makecache step rebuilds the index so subsequent commands run instantly. This two-step sequence resolves the majority of phantom dependency errors without touching installed packages.

Run df -h /var before cleaning. A full disk will cause metadata downloads to fail silently and corrupt the cache again. Trust the package manager. Manual file edits drift, fresh metadata stays accurate.

Isolate and resolve the blocking package

Sometimes a single package blocks the entire transaction. You need to identify it and handle it directly. Forcing the transaction will only create a worse state.

sudo dnf upgrade --refresh --skip-broken
# Continues the transaction while ignoring packages that cannot be resolved
# Useful for identifying the exact blocker without aborting everything

The --skip-broken flag is a diagnostic tool, not a permanent fix. It tells DNF to proceed with everything it can resolve and leave the problematic packages untouched. The output will list exactly which packages were skipped. Once you have the name, you can downgrade it to the last known good version or remove it if it is no longer needed.

sudo dnf downgrade <package-name>
# Reverts the package to the last available version in the enabled repositories
# Resolves conflicts caused by manual installs or failed partial upgrades

Downgrading is safe when the repository still carries the older version. Fedora keeps recent versions in the main repositories for a short window after a release. If the older version has been removed, you will need to remove the package entirely and reinstall it after the system stabilizes. Avoid --allowerasing unless you fully understand what will be removed. That flag tells DNF to delete conflicting packages automatically. It can remove desktop environments or critical system services if the solver finds a shorter path to a valid state.

Check the transaction history before making irreversible changes. Run dnf history list to see what changed recently. Roll back the last transaction with dnf history undo <id> if you recognize a bad batch. Read the actual error before guessing.

Verify the transaction state

After applying fixes, you need to confirm the dependency graph is clean. DNF provides a built-in verification tool that scans the installed database without modifying anything.

sudo dnf check
# Scans the installed RPM database for broken dependencies and conflicts
# Returns nothing if the system is clean
# Prints a list of unresolved requires if problems remain

A clean run produces no output. That is the expected result. If dnf check prints warnings, the solver still sees unresolved nodes. Review the output carefully. It will show which package requires which library and why the match failed. You can cross-reference the output with dnf repoquery --requires <package> to see what the repository actually provides. This comparison reveals whether the missing dependency was renamed, split into a subpackage, or dropped entirely.

Run rpm -Va only when you suspect file-level corruption. It compares installed files against the RPM database checksums. It does not fix dependency graphs. Stick to DNF for package resolution. Snapshot the system before the upgrade. Future-you will thank you.

Common pitfalls and exact error messages

Dependency errors follow predictable patterns. Recognizing the exact wording saves time.

Error: Transaction test error: package python3-3.12.4-1.fc40.x86_64 conflicts with python3-3.13.0-1.fc41.x86_64

This message means two packages claim to provide the same virtual dependency, and DNF refuses to install both. Python major versions are a classic example. The system cannot run two different Python 3 interpreters as the default. Resolve this by removing the older version or using dnf downgrade to align with the repository baseline.

Problem: package foo-1.0-2.fc40.x86_64 requires bar >= 2.0, but none of the providers can be installed

This message means the required library exists in the repository, but installing it would break something else. The solver found a valid path for bar, but that path conflicts with another installed package. Check your enabled repositories. Third-party repos often carry newer library versions that the base system cannot satisfy. Disable the conflicting repo temporarily and retry.

Error: Nothing provides libssl.so.3()(64bit) needed by openssl3-3.0.0-1.fc40.x86_64

This message means the virtual file dependency is missing. The package expects a shared library that no installed or available package provides. This usually happens after a major library transition or a partial upgrade. Run dnf distro-sync to pull the missing provider. If the provider was renamed, use dnf provides */libssl.so.3 to find the correct package name.

Read the first line of the error. It always names the blocking package. Ignore the verbose solver trace until you understand the root cause. Reboot before you debug. Half the time the symptom is gone.

Choose the right recovery path

Use dnf distro-sync when your system has drifted from the repository baseline after a partial upgrade or manual package installation. Use dnf clean all when metadata downloads fail or you suspect a corrupted local cache. Use dnf downgrade when a specific package version is blocking the entire transaction graph. Use dnf upgrade --skip-broken when you need to identify the exact blocking package without aborting a large update batch. Stay on the default repositories when you want predictable dependency resolution and automatic security patches.

Where to go next