yum history — quick reference
On RHEL 8+ and Fedora, replace yum with dnf — subcommands are the same (dnf history undo ID). On RHEL 7, use yum.
Compare wrapper paths with which yum versus which dnf; the which command shows how PATH order picks the executable.
List and inspect
| When to use | Command |
|---|---|
| List all transactions | sudo yum history |
| Same on dnf-based systems | dnf history |
| Details for one transaction ID | sudo yum history info ID |
| History involving one package | sudo yum history info package_name |
| List only transaction IDs for a package | sudo yum history info package_name | grep '^[0-9]' |
Reverse transactions
| When to use | Command |
|---|---|
| Undo exactly one transaction | sudo yum history undo ID |
| Repeat a past transaction | sudo yum history redo ID |
| Roll back everything after an ID | sudo yum history rollback ID |
| dnf equivalents | sudo dnf history undo ID / redo / rollback |
Safety checks
| When to use | Command |
|---|---|
| See orphaned RPMs before undo needs old NEVRAs | sudo yum list extras or sudo package-cleanup --orphans (RHEL 7) |
| Confirm yum points at dnf on RHEL 8+ | ls -l $(which yum) $(which dnf) |
yum history — command syntax
History is a subcommand of yum/dnf. Synopsis from dnf history --help (RHEL 8+ / Fedora):
dnf history [list] [--reverse] [<packages>...]
dnf history info [<transaction-id> | <package-name>...]
dnf history undo <transaction-id>
dnf history redo <transaction-id>
dnf history rollback [--force] <transaction-id>Each successful install, upgrade, or remove gets a numeric transaction ID. The database usually lives under /var/lib/dnf/history/ (RHEL 8+) or /var/lib/yum/history/ (RHEL 7). rpm -i outside yum/dnf is not recorded and can break undo.
yum history — command examples
Essential List all yum/dnf transactions
Start every rollback by finding the transaction ID in the history table.
Run on RHEL/Fedora:
sudo yum historySample output:
ID | Command line | Date and time | Action(s) | Altered
----------------------------------------------------------------------------
45 | downgrade python3-bind-9 | 2020-08-22 14:13 | Downgrade | 5
42 | install abrt | 2020-08-22 14:04 | Install | 18
38 | install kernel | 2020-08-20 09:00 | Install,Upd | 3Column guide: ID is what you pass to undo/rollback; Action(s) shows install/update/remove codes; Altered is the package count.
On systems where yum is a symlink to dnf, the same table is shared — use either front-end consistently.
Essential Inspect one transaction by ID
Before undoing, read which packages and versions changed in that single transaction.
Run the command:
sudo yum history info 42Sample output:
Transaction ID : 42
Begin time : Sat 22 Aug 2020 02:04:08 PM UTC
Begin rpmdb : 1234567:abc...
End time : Sat 22 Aug 2020 02:04:45 PM UTC
User : root
Return-Code : Success
Command Line : install abrt
Install : abrt-2.14.6-1.el8.x86_64
Install : abrt-addon-ccpp-2.14.6-1.el8.x86_64
...If Return-Code is not Success, undo may still be possible but warrants extra caution.
Essential Undo one transaction
Reverse a single mistaken install — removes packages that transaction added and reinstalls versions that transaction removed.
Example: undo transaction 42 that installed abrt:
sudo yum history undo 42Sample output:
Undoing transaction 42 ...
Removed:
abrt-2.14.6-1.el8.x86_64
abrt-addon-ccpp-2.14.6-1.el8.x86_64
...
Complete!Older RPM builds must still be reachable in enabled repos — if mirrors dropped them, undo fails with missing NEVRA errors. Check orphans before large updates on legacy systems.
Common Find transactions that touched one package
When you know the package name but not the ID, search history by RPM name.
Run the command:
sudo yum history info kernelSample output (truncated):
Transaction ID : 38
Begin time : Thu 20 Aug 2020 09:00:00 AM UTC
Command Line : install kernel
Install : kernel-4.18.0-372.el8.x86_64
...
Transaction ID : 12
...Extract IDs only:
sudo yum history info kernel | awk '/^Transaction ID/{print $4}'Common Redo a transaction
Re-apply the same change after an undo — useful when undo was a test or the wrong ID was reversed.
Run the command:
sudo yum history redo 42Sample output:
Redoing transaction 42 ...
Installed:
abrt-2.14.6-1.el8.x86_64
...
Complete!redo repeats the recorded action; it does not invent a newer package version from repos.
Common Rollback to a point in history
Rollback reverses every transaction after the given ID — broader than undo.
Example: return to the state at transaction 45:
sudo yum history rollback 45Sample output:
Rolling back transaction 46, 47, 48 ...
Downgrading:
python3-bind-9.11.26-4.el8.x86_64
...
Upgraded:
...
Removed:
...
Complete!A wide rollback can remove many dependency packages — read the transaction list first. Failed rollbacks often involve kernel, glibc, or SELinux policy downgrades.
Common yum and dnf share history on RHEL 8+
On modern RHEL, both commands hit the same dnf backend.
Check symlinks:
ls -l $(which yum) $(which dnf)Sample output:
lrwxrwxrwx 1 root root 5 May 7 17:04 /usr/bin/dnf -> dnf-3
lrwxrwxrwx 1 root root 5 May 7 17:04 /usr/bin/yum -> dnf-3Use one tool per workflow — if a future release split databases, match the tool that performed the original transaction. See dnf command for day-to-day package work on RHEL 8+.
Advanced When rollback fails (kernel / SELinux)
Some downgrades are blocked because the running kernel or SELinux policy cannot safely revert.
Typical failure:
Error: package kernel-4.18.0-200.el8.x86_64 (which is older than installed kernel) cannot be installedMitigation:
- Use
undoon the smallest recent transaction instead of a widerollback - Avoid rolling back
kernel,glibc, orselinux-policy-*in place — boot an older kernel entry or restore from snapshot/backup - Never treat history as a full system restore — config files you edited by hand are not reverted
A strong answer is: history fixes RPM state, not /etc customizations or boot loaders.
Advanced rpm -i bypasses history
Packages installed with raw rpm do not appear in yum history and can leave dependencies inconsistent.
List a package:
rpm -q abrtIf yum history info abrt shows gaps but rpm -q succeeds, undo may fail until you manually rpm -e or reinstall via yum/dnf to resync the database.
Prefer yum or dnf for installs so every change has an ID you can reverse.
yum history — when to use / when not
| Use yum/dnf history when | Use something else when |
|---|---|
|
|
yum history vs dnf downgrade
history undo / rollback |
dnf downgrade pkg |
|
|---|---|---|
| Scope | Replays a recorded transaction (all packages in that ID) | One package (dependencies may lag) |
| Dependency cleanup | yum/dnf removes extras the original install pulled in | often leaves orphan deps |
| Best for | reverting a known bad dnf update session |
single-package version pin |
On RHEL 8+, daily package work lives on dnf; RHEL 7 admins use yum.
Related commands
RPM package management on RHEL-family systems.
| Command | One line |
|---|---|
| yum history | Undo, redo, rollback transactions (this page) |
| rpm | Low-level RPM query/install (bypasses history) |
Browse the full index in our Linux commands reference.
yum history — interview corner
What is yum history?
yum history (and dnf history) is a transaction log stored in SQLite under /var/lib/dnf/history/ or /var/lib/yum/history/. Every yum/dnf install, update, or remove gets a numeric ID with timestamps, user, and package NEVRAs.
It lets you undo one transaction or rollback to an earlier ID without manually downgrading dozens of RPMs.
A strong answer is:
"yum/dnf history records each package transaction with an ID. I use history info to inspect, then history undo for one step or rollback to rewind multiple transactions — on RPM distros only."
What is the difference between history undo and rollback?
| Command | Effect |
|---|---|
history undo ID |
Reverses that one transaction |
history redo ID |
Re-applies that transaction |
history rollback ID |
Reverses all transactions after ID |
Rollback is wider and riskier — start with undo on the smallest fix.
A strong answer is:
"undo reverses a single transaction ID; rollback rewinds everything after an ID. I undo one bad install before attempting a wide rollback."
On RHEL 8, do yum and dnf share history?
Usually yes — /usr/bin/yum is a symlink to dnf, and both use the same history database. Commands map 1:1 (yum history undo = dnf history undo).
Caveat: if tooling diverges in a future release, use the same front-end that performed the original change.
A strong answer is:
"On RHEL 8+ yum is typically dnf — shared history DB. I confirm with ls -l which yum and use dnf history for clarity."
What are the risks of yum history rollback?
History does not:
- Restore edited config files
- Safely downgrade running kernel or SELinux policy
- See
rpm -iinstalls done outside yum
Failed rollbacks leave the system unchanged if dependency checks fail — but partial success on complex trees can still hurt. Always have snapshots/backups before wide rollbacks.
A strong answer is:
"History only reverses RPM transactions — not /etc edits. I avoid rolling back kernel/glibc/SELinux; I use undo for small changes and backups for disasters."
Why does history undo fail with missing package versions?
undo needs the older RPMs still available in enabled repos. If mirrors dropped them, yum/dnf cannot reinstall the previous NEVRA.
Check what is installed but not from current repos (package-cleanup --orphans on RHEL 7, dnf list extras on newer releases) and keep local mirrors or dnf download copies before major updates.
A strong answer is:
"Undo needs previous RPM versions in repos — if they're gone, history can't reverse. I mirror or download critical NEVRAs before big updates."
Can yum history replace backups?
No. History tracks RPM install state, not:
- Application data under
/var/lib - Database dumps
- Bootloader or initramfs changes you made manually
Use LVM snapshots or image backups for production; history is a convenience for recent package mistakes.
A strong answer is:
"History is for reversing recent yum/dnf package transactions — not a backup strategy. Snapshots and imaging still own disaster recovery."
Troubleshooting
| Symptom | Likely cause | What to try |
|---|---|---|
Cannot find RPM compatible with on undo |
Old NEVRA dropped from repos | Enable vault/ULN mirror; local copy from dnf download |
| Rollback wants kernel downgrade | Running kernel newer than target | Boot older kernel entry; avoid kernel in rollback |
No such command: history |
Wrong distro or minimal image | Install dnf / yum; not available on Debian/Ubuntu |
| Undo says success but app still broken | Config files not managed by RPM | Restore /etc from backup |
| Transaction missing | Installed with rpm -i |
rpm -qa, reinstall via dnf to normalize |
| yum and dnf show different IDs | Rare split tooling | Pick one tool; see ls -l $(which yum) |

