[RHEL6] Using yum to roll back an update(s)

Latest response

Hello Techs!

 

I want to share with you the following.

 

Did you know that RHEL 6 includes the yum history module?  You can use this to rollback any updates done with the 'yum' command.

Check out this example: http://people.redhat.com/rprice/yum_history.txt

With this command, you can choose an update 'yum' issued and remove those selected packages.

From the yum man page:

 

history

The history command allows the user to view what has happened in past transactions (assuming the history_record config. option is set). You can use info/list/summary to view what happened, undo/redo to act on that information and new to start a  new history
file.

The info/list/summary  commands  take either a transaction id or a package (with wildcards, as in Specifying package names), all three can also be passed no arguments. list can be passed the keyword "all" to list all the transactions.

The undo/redo commands take either a transaction id or the keyword last and an offset from the last transaction  (Eg.  if you’ve done 250 transactions, "last" refers to transaction 250, and "last-4" refers to transaction 246).

The addon-info command takes a transaction ID, and the packages-list command takes a package (with wildcards).

In "history  list" output the Altered column also gives some extra information if there was something not good with the transaction (this is also shown at the end of the package column in the packages-list command).

> - The rpmdb was changed, outside yum, after the transaction.
< - The rpmdb was changed, outside yum, before the transaction.
* - The transaction aborted before completion.
# - The transaction completed, but with a non-zero status.
E - The transaction completed fine, but had warning/error output during
the transaction.
P - The transaction completed fine, but problems already existed in the rpmdb.
s - The transaction completed fine, but --skip-broken was enabled and had to skip some packages.

Gotchas:

We have done a test with this command.  We upgraded from RHEL6.0 to RHEL6.1 and did a rollback with using yum.  This command completed but left the system in a "broken" state where libgcc and others library's did not rollback correctly.  We suspect it's likely because SPEC files aren't written with rolling back in mind.  Make note of this.  For small update rollbacks, this appears to be working great!
 

Hope this proves to be useful for someone. 

I'd appreciate your feedback and comments

~rp

Responses