CompTIA Linux+ (XK0-006)System ManagementMedium
A recent 'dnf update' on a Fedora-based server introduced a broken dependency that is causing a critical service to fail. Which command reverts the system to the state before that last transaction?
- Adnf clean packages
- Bdnf history undo last
- Cdnf downgrade --all
- Ddnf remove --oldpackage
Show answer & explanationAnswer & explanation
Correct answer: B. dnf history undo last
dnf history undo last reverses the actions performed by the most recent dnf transaction, restoring previously installed or removed packages to their prior state, which is the standard way to roll back a problematic update.
Why the other options are wrong
- A. dnf clean packages only clears the local package cache and has no effect on installed packages.
- C. dnf downgrade --all is not valid syntax for reverting an entire transaction; downgrade needs specific package names.
- D. dnf remove --oldpackage is not a valid dnf option.
dnf history undo
dnf history undo <id|last> reverses a specific past transaction, reinstalling removed packages and removing/downgrading updated ones to restore the prior state.
- dnf history list shows past transaction IDs
- 'last' refers to the most recent transaction
- dnf history rollback <id> reverts to a specific point, undoing multiple transactions
Memory trick: 'History undo = the package time machine's rewind button.'