Undoing Package Changes with DNF History Rollback on Fedora
Use DNF's built-in transaction history to undo problematic package installations or upgrades on Fedora. This guide covers viewing history, inspecting changes, executing rollback, verifying results, and handling limitations like kernel updates or dependency conflicts.
24 Mar 2026, 16:56 UTC

Problem and Takeaway
A system update or package installation introduces regressions—broken dependencies, missing libraries, or behavioral changes in applications. Fedora's DNF package manager records every transaction in /var/lib/dnf/history/, letting you revert a specific operation without a full system restore. The rollback uninstalls packages added in that transaction, reinstalls packages removed, and preserves user-modified configuration files where possible.
Prerequisites
- Fedora 38 or later (DNF 5.x behavior is consistent; commands shown work on DNF 4 and 5).
- Root or sudo access to run
dnf historyanddnf history rollback. - Transaction history must not have been cleared (
dnf clean alldoes not remove history, but manual deletion of/var/lib/dnf/history/*does). - Target transaction should not involve kernel packages, SELinux policy updates, or third-party repository metadata changes—these are not reverted by rollback.
View Transaction History
Run the following as root or with sudo to list recent transactions with IDs, dates, and actions:
dnf history listOutput example (truncated):
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
42 | install podman | 2026-10-08 14:22 | Install | 12
41 | upgrade | 2026-10-07 09:15 | Upgrade | 47
40 | remove firefox | 2026-10-06 16:40 | Remove | 1Note the ID of the transaction you want to undo. You can also filter: dnf history list podman shows only transactions mentioning "podman".
Inspect a Transaction Before Rollback
Review the exact package changes for a given ID:
dnf history info 42This prints each package with its version, repository, and whether it was installed, upgraded, or removed. Confirm the list matches the change you intend to reverse.
Perform the Rollback
Execute the rollback for the chosen transaction ID. DNF will show a summary of packages to be removed, installed, or downgraded and prompt for confirmation:
dnf history rollback 42Type y to proceed. The operation uninstalls packages added by transaction 42 and reinstalls packages that transaction removed. Configuration files you modified under /etc are preserved (marked .rpmnew or .rpmsave as appropriate).
Verify System State After Rollback
Check that the expected packages are now at their pre-transaction versions:
dnf repoquery --last=1This shows the most recent transaction's effect. Alternatively, query specific packages:
rpm -q podmanCompare the version against what dnf history info 42 reported before rollback.
Limitations and Recovery Options
- Kernel and SELinux changes are not rolled back. If the transaction updated the kernel or SELinux policy, those remain at the newer version. Boot into a previous kernel from the GRUB menu if needed.
- Third-party repository metadata changes persist. If the transaction added or modified a repo file, rollback does not revert it. Manually edit or remove
/etc/yum.repos.d/entries. - Dependency conflicts can block rollback. If later transactions installed packages that depend on the ones you're trying to remove, DNF will refuse. You may need to roll back the later transactions first (higher IDs) in reverse chronological order.
- History cleared? No rollback possible. If
/var/lib/dnf/history/is empty, you must manually downgrade or remove packages usingdnf downgradeordnf removewith specific versions.
Roll Back a Range of Transactions
To undo multiple consecutive transactions, specify the earliest ID in the range with --last:
dnf history rollback --last=40This rolls back transactions 42, 41, and 40 (assuming 42 is the latest). Review the combined package list carefully before confirming.
Quick Reference
| Command | Purpose |
|---|---|
dnf history list | List all transactions with IDs |
dnf history list <keyword> | Filter by package name or command |
dnf history info <id> | Show detailed package changes for a transaction |
dnf history rollback <id> | Revert a single transaction |
dnf history rollback --last=<id> | Revert all transactions from latest down to <id> |
dnf repoquery --last=1 | Verify the most recent transaction's net effect |
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.