• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“yum history” command examples to display, rollback, redo, undo yum transactions

by admin

“yum history” feature of yum is a mostly overlooked but very powerful utility in Linux. It can be used to rollback/redo/undo yum transaction to a state where everything was working fine.

yum history

“yum history list” command when run without any arguments produces output similar to shown below. “yum history” or “yum history list” by default shows last 20 yum transactions.

# yum history list

yum history list command output

Here,
ID: Uniquely identifies a yum transaction.
Command line:
Date and time: Date and time of transaction.
Action(s): Action performed in the transaction like Install, update etc. Detail list is given below.

Action Abbreviation Description
Downgrade D At least one package has been downgraded to an older version.
Erase E At least one package has been removed.
Install I At least one new package has been installed.
Obsoleting O At least one package has been marked as obsolete.
Reinstall R At least one package has been reinstalled.
Update U At least one package has been updated to a newer version.

Altered: Number of packages that were affected by a transaction and additional information like whether rpmdb database was changed before are after transaction etc. Detail list is given below.

Symbol Description
< Before the transaction finished, the rpmdb database was changed outside Yum.
> After the transaction finished, the rpmdb database was changed outside Yum.
* The transaction failed to finish.
# The transaction finished successfully, but yum returned a non-zero exit code.
E The transaction finished successfully, but an error or a warning was displayed.
P The transaction finished successfully, but problems already existed in the rpmdb database.
s The transaction finished successfully, but the –skip-broken command-line option was used and certain packages were skipped.

To display all transactions, use the all option.

# yum history list all

Information on a specific transaction

If you know the transaction ID of a yum transaction, you can get a detailed view on it using the below command.

# yum history info 1

For example :

yum history info command

you can also use the package name with yum history command. For Example :

# yum history info vsftpd

yum history info with package name

The above command will show all the transaction like install, update, removal of the package vsftpd.

You can also get a summary of transaction history on a specific package using the the summary option. For Example :

yum history summary command

Rollback or redo a yum transaction

You can undo a specific yum transaction using the command below syntax:

# yum history rollback [transaction_ID]

For example:

yum history undo rollback a transaction

Similarly you can also redo the yum transaction. For Example :

# yum history redo [transaction ID]

We will redo the removed sysstat package removal using the command shown in the figure below.

yum history redo command example

The redo sub-command can also take some optional arguments before we specify a transaction:
force-reinstall – reinstalls any packages that were installed in that transaction (via yum install, upgrade or downgrade).
force-remove – removes any packages that were updated or downgraded.

Rollback yum transaction to a certain point

With yum history command you can roll back all transaction until a particular transaction ID. For example, if you specify transaction ID of 16, all transactions from the latest to transaction ID 16 will be rolled back. For Example :

# yum history rollback 16

yum history rollback command output

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : How to Change the machine-id
  2. How to Enable Verbose Logging for VSFTPD
  3. imagemagick for image optimization
  4. pvcreate error : Can’t open /dev/sdx exclusively. Mounted filesystem?
  5. “Authorization not available. Check if polkit service is running or see debug message for more information” – CentOS/RHEL 7 ssh service error
  6. lvreduce Command Examples in Linux
  7. id Command Examples in Linux
  8. eject Command Examples in Linux
  9. head Command Examples in Linux
  10. lvcreate/lvremove Failed with Error “Can’t remove merging snapshot logical volume”

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright