Roll Back Package Changes with dnf history undo

dnf history records every install/upgrade transaction with an ID, and history undo reverses a chosen one package-by-package.

LinuxpackagesdnffedoraMedium risk
Run `sudo dnf history` to list past transactions with IDs, then `sudo dnf history undo <id>` to reverse a specific transaction.

01Command

Command
$ sudo dnf history

02What it does

Every dnf action is written to a transaction history with ID, timestamp, and the acting user — `dnf history info <id>` shows exactly which packages were installed, upgraded, or erased. `dnf history undo <id>` applies the inverse operations, and `history rollback <id>` rewinds the system to the state after that transaction. This is the forgotten safety net when an update breaks something and you want package-level reversal rather than a VM rollback.

03Risk

RiskMedium risk
RequirementsDNF-based distribution (Fedora, RHEL, CentOS Stream); use dnf5 or dnf4 syntax as installed.
!Warning: Undo works at the package level only — it will not revert configuration-file edits or database migrations a package performed.

04Undo

Undo
$ sudo dnf history undo <transaction-id>

05Sources

  • DNF Command Reference — history commands
    DNF Documentation · vendor-doc · 2026-09-17
    Evidence: dnf history lists transactions, dnf history info <id> shows details, and dnf history undo <id> repeats the inverse of the specified transaction.

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions