yum history undo and rollback: Revert RPM Transactions on RHEL and Fedora

On RHEL, Fedora, and related RPM distros, yum and dnf record each install, update, and remove in a SQLite history. Use history list, info, undo, redo, and rollback to reverse transactions — not a substitute for backups or snapshot restore.

Published

Updated

Read time 9 min read

Reviewed byDeepak Prasad

yum history undo and rollback: Revert RPM Transactions on RHEL and Fedora
About On RHEL, Fedora, and related RPM distros, yum and dnf record each install, update, and remove in a SQLite history. Use history list, info, undo, redo, and rollback to reverse transactions — not a substitute for backups or snapshot restore.
Tested on RHEL 8.10 / Fedora 41; dnf 4.x
Man page yum history(8)
Privilege root / sudo
Distros

RHEL 7 (yum), RHEL 8+, Fedora, Rocky Linux, AlmaLinux (dnf; yum is often a symlink).

Ubuntu/Debian: apt — no yum/dnf history.

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):

text
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:

bash
sudo yum history

Sample output:

text
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  |      3

Column 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:

bash
sudo yum history info 42

Sample output:

text
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:

bash
sudo yum history undo 42

Sample output:

text
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:

bash
sudo yum history info kernel

Sample output (truncated):

text
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:

bash
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:

bash
sudo yum history redo 42

Sample output:

text
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:

bash
sudo yum history rollback 45

Sample output:

text
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.

Advanced When rollback fails (kernel / SELinux)

Some downgrades are blocked because the running kernel or SELinux policy cannot safely revert.

Typical failure:

text
Error: package kernel-4.18.0-200.el8.x86_64 (which is older than installed kernel) cannot be installed

Mitigation:

  • Use undo on the smallest recent transaction instead of a wide rollback
  • Avoid rolling back kernel, glibc, or selinux-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:

bash
rpm -q abrt

If 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
  • A recent yum/dnf install or update broke an application and repos still have older RPMs
  • You need to reverse one mistaken transaction with a known ID
  • You want a supported alternative to hand-picking dnf downgrade on many packages
  • You are on RHEL, Fedora, Rocky, or Alma with dnf/yum history enabled
  • You are on Ubuntu/Debianapt (no yum history)
  • You need full system restore → backups, LVM snapshots, or imaging
  • The change involved kernel, glibc, or SELinux policy downgrade → reboot/snapshot strategy
  • Packages were installed with rpm -i outside yum/dnf
  • You edited config files by hand — history does not restore them
  • You need to jump an entire minor OS release → clean reinstall or leapp, not rollback

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.


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 -i installs 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)

References

Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …