How does DNF transaction history let you undo a change?
DNF logs every install/update/remove as a numbered transaction; dnf history lists them and dnf history undo ID reverses one — a safety net for "that update broke something."
Every DNF action is recorded as an atomic, numbered transaction, which means changes are reversible — a major advantage over hand-installing with rpm. The commands:
| Command | Purpose |
|---|---|
dnf history |
List recent transactions (newest first) |
dnf history info ID |
What exactly did transaction ID change? |
dnf history undo ID |
Reverse that transaction |
dnf history redo ID |
Re-apply it |
dnf history
# ID | Command line | Date/time | Action | Altered
# 8 | install httpd | 2024-01-15 10:30 | Install | 10
# 7 | update | 2024-01-14 09:00 | Upgrade | 45
dnf history undo 8 # cleanly removes httpd + the 10 packages it pulled in
Why this is powerful: an "undo" reverses the whole transaction — the package and all the dependencies it dragged in — restoring the prior state, rather than you trying to remember and unpick each piece. So if an update breaks a service, you roll the entire update back by its ID. (DNF logs the details to /var/log/dnf.rpm.log.) The transaction ID you need is always the leftmost column of dnf history.
Go deeper:
DNF command reference — history command —
history,history info,history undo,history redo.