How to revert a yum update on CentOS

Every so often, a yum update brings unexpected results with it, like services no longer working due to spurious error messages that don’t tell you what’s actually wrong. This only very rarely happens though, and we may need to revert to the state of our system before such an update took place.

Thankfully, yum has a nice feature that helps us do this, namely yum history.

The command will bring up the latest 20 transactions by default, be those installs, updates or removals. There’s a transaction ID at the very front of each line, with which we can tell yum to undo said transaction. In my case, transaction 86 didn’t work out so well, so let’s undo whatever has happened there (in my case, a combination of installs, updates and overwrites).

Let’s revert those changes with yum history undo 86

The familiar text output comes up, eventually showing a list of packages that will be affected. Confirm those changes with y and let yum do it’s job.

After a few moments, our system has been restored to a state from before the update occurred, hopefully back into a running state.

There’s another interesting option called yum history rollback (ID). This will let us go back more than one step in our list, restoring the changes made by multiple transactions. Vivke’s article has more information on this.

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

1 thought on “How to revert a yum update on CentOS

Add your voice!