The dnf downgrade command installs an older version of an installed package, replacing the current one. You run it with the package name and optionally a specific version, and DNF resolves the dependencies and performs the downgrade. This is useful when a newer update introduces a bug or breaks compatibility.
Background: Why Downgrade a Package?
On Fedora, RHEL, and other RPM-based distributions, DNF is the default package manager. It normally keeps packages up to date, but sometimes a new version causes problems: a regression in a feature, a compatibility issue with another package, or a configuration change you don’t like. Downgrading lets you revert to the last known-good version while you wait for a fix or decide to pin the older version.
The dnf downgrade command is the official way to do this. It works similarly to dnf upgrade but in reverse: it fetches an older package from the configured repositories and replaces the installed version. DNF also handles dependencies, so if the older version requires different libraries, it will try to install those too.
How the Command Works
The basic syntax is:
sudo dnf downgrade <package-name>
When you run this, DNF searches the enabled repositories for an older version of the package. If it finds one, it asks for confirmation and then proceeds. If no older version is available in the repos, you’ll get an error like No available packages.
To downgrade to a specific version, append the full version string:
sudo dnf downgrade <package-name>-<version>-<release>.<arch>
For example, to downgrade firefox to version 115.0.2, you might run:
sudo dnf downgrade firefox-115.0.2-1.fc38.x86_64
You can find available versions with dnf list --showduplicates <package-name>.
Choosing the Right Version
Before downgrading, you need to know which version you want. Use the --showduplicates flag to list all versions available in the repositories:
dnf list --showduplicates <package-name>
This shows versions like 1.2.3-1.fc38 and 1.2.2-1.fc38. Pick the one you want and use the full name (including the release and architecture) in the downgrade command.
If you don’t specify a version, DNF will pick the newest version that is older than the currently installed one. That’s usually what you want, but it might not be the exact version you had in mind.
Common Problems and Solutions
No older version in repos – If the package was only in a previous release of the distribution, the current repos may not have it. You can try enabling a different repository that still carries it, or use a local RPM file with dnf install ./package.rpm.
Dependency conflicts – The older version might require older libraries that are no longer available. DNF will try to resolve this, but sometimes it fails. In that case, you may need to downgrade the dependencies as well, or use --allowerasing (with caution) to remove conflicting packages.
DNF refuses to downgrade – If the installed version is newer than anything in the repos, DNF will say there’s nothing to downgrade to. This can happen if you installed a package from a Copr or a third-party repo that has since been removed.
Alternatives to dnf downgrade
If dnf downgrade doesn’t work for your situation, there are other approaches:
- Manual install of an RPM file – Download the older RPM from a trusted source and run
sudo dnf install ./old-package.rpm. This forces the version change, but you must ensure dependencies are met. - Versionlock plugin – After downgrading, you can use
dnf versionlock add <package>to prevent future upgrades of that package. - Snapshots and rollback – If you use a tool like
snapperor a Btrfs snapshot, you can roll back the entire system to a previous state, which is safer for complex changes.
Safety and Caveats
Downgrading can break things if the older version is incompatible with your system’s current libraries or configuration files. Always back up important data first. After downgrading, test the package thoroughly to ensure it works as expected.
Also, note that downgrading a package that is a dependency of many others can cascade into a large number of changes. DNF will show you the full transaction before applying it, so review it carefully.
If you downgrade to a version that is no longer supported (e.g., an old Firefox with known security vulnerabilities), you are exposing yourself to risk. Only downgrade when necessary and consider pinning the version until an official fix is released.
Frequently Asked Questions
Can I downgrade to any version I want?
Only if that version is available in an enabled repository or as a local RPM file. DNF cannot invent versions that don’t exist in the repos.
What if the downgrade fails halfway?
DNF transactions are atomic: if a step fails, it rolls back to the previous state. You should be left with the original package intact.
Will downgrading affect my configuration files?
Configuration files are usually preserved, but if the older version uses a different format, the program may ignore or reset them. Check the package’s documentation.
How do I prevent a package from being upgraded again?
Use the DNF versionlock plugin: sudo dnf install python3-dnf-plugin-versionlock, then sudo dnf versionlock add <package>.
Is there a way to see what version I had before?
DNF logs transactions in /var/log/dnf.rrd or /var/log/dnf.log. You can also check the RPM database with rpm -q --changelog <package> to see version history.
Can I downgrade a kernel?
Yes, but be careful. You can install an older kernel with sudo dnf install kernel-<version> and then select it at boot. It’s safer to keep the new kernel installed and just boot the old one.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Channel TLD Websites: What They Are & How to Get One5.00 min/km
- Django Class Based Views CRUD REST API
- Most Secure OS for Privacy: 3 Picks by Device
- Ryobi One+ Battery System: Is the Switch Worth It?
- Tmux Terminal Upgrade: Is It Worth It?
- Synology Azure Backup: How to Back Up to Azure