How to use yum history to roll back an update in Red Hat Enterprise Linux/Centos 6 , 7

By | March 11, 2018


  • Red Hat Enterprise Linux 6 , 7
  • yum


  • How to roll back an update using yum in Red Hat Enterprise Linux-6, 7?
  • How to use yum history?
  • Information on best practice to enable easy backout of yum patching


Note: Rollback of selinuxselinux-policy-*kernelglibc (dependencies of glibc such as gcc) packages to older version is not supported. Thus, downgrading a system to minor version (ex: RHEL6.1 to RHEL6.0) is not recommended as this might leave the system in undesired state. Use the yum history option for small update rollbacks.

  • If you decide to proceed with rollback, rather then reinstall, please start with following documentation.
  • The following is an example of using yum to both install & undo (ie. remove) the screen package:
    • First will install screen RPM
      # yum install screen
      Dependencies Resolved
       Package          Arch       Version            Repository              Size        
       screen           i686       4.0.3-16.el6       rhel-6-server-rpms      484 k      
        screen.i686 0:4.0.3-16.el6
    • Next, identify the transaction ID that we want to ‘undo’
      # yum history
      Loaded plugins: product-id, refresh-packagekit, subscription-manager
      Updating Red Hat repositories.
      ID     | Login user               | Date and time    | Action(s)      | Altered
           8 | root <root>              | 2011-10-03 14:40 | Install        |    1   
           7 | root <root>              | 2011-09-21 04:24 | Install        |    1 ##
           6 | root <root>              | 2011-09-21 04:23 | Install        |    1 ##
           5 | root <root>              | 2011-09-16 13:35 | Install        |    1   
           4 | root <root>              | 2011-09-16 13:33 | Erase          |    1   
           3 | root <root>              | 2011-09-14 14:36 | Install        |    1   
           2 | root <root>              | 2011-09-12 15:48 | I, U           |   80   
           1 | System <unset>           | 2011-09-12 14:57 | Install        | 1025  
    • The transaction ID we are interested in is ‘8’, so move forward with undo step. If want to see additional information to verify this is transaction interested in, use yum history info 8 prior to doing the undo
      # yum history undo 8
      Loaded plugins: product-id, refresh-packagekit, subscription-manager
      Updating Red Hat repositories.
      Undoing transaction 8, from Mon Oct  3 14:40:01 2011
          Install screen-4.0.3-16.el6.i686
      Resolving Dependencies
      --> Running transaction check
      ---> Package screen.i686 0:4.0.3-16.el6 will be erased
      --> Finished Dependency Resolution
      Dependencies Resolved
       Package          Arch       Version            Repository              Size
       screen           i686       4.0.3-16.el6       @rhel-6-server-rpms     783 k
        screen.i686 0:4.0.3-16.el6

Diagnostic Steps

  • Doing full system backup prior to any update is always recommended, and yum history is NOT meant to replace systems backups.
  • General documentation of the system state both prior to and after patching is always good practice. This should include running package-cleanup with following flags, –orphans, –problems, –dupes, –leaves.
  • yum history undo will require access to all the previous RPM version; thus, need to ensure the older RPM versions are available to the system. It is recommended that prior to doing updates, you closely inspect the output of package-cleanup --orphans to know what currently installed RPMs are no longer available in the enabled repositories. This should not be a concern if using the standard RHEL repositories provided by Red Hat as multiple versions of RPM are maintained in these locations.
  • If yum history undo has problem with a given package, it is possible to exclude with the --exclude command line flag, and then can deal with exception manually.
  • As after any RPM changes, recommend checking the yum output/logs for any messages and/or rpm{new,orig,save} files created.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.