Menu Close

Chapter 9. Handling package management history

With the dnf history command, you can review the following information

  • Timeline of DNF transactions
  • Dates and times the transactions occurred
  • Number of packages affected by the transactions
  • Whether the transactions succeeded or were aborted
  • If the RPM database was changed between the transactions

The dnf history command can also be used to undo or redo the transactions.

The following section describes how to use dnf to handle package management history in Red Hat Enterprise Linux 9:

9.1. Listing transactions

The following procedure describes how to list the latest DNF transactions, the latest operations for a selected package, and details of a particular transaction.

Procedure

  • To display a list of all the latest DNF transactions, use:

    # dnf history
  • To display a list of all the latest operations for a selected package, use:

    # dnf history list package-name

    Replace package-name with the name of the package. You can filter the command output by appending global expressions. For more details, see Specifying global expressions in dnf input.

  • To display details of a particular transaction, use:

    # dnf history info transactionID

    Replace transactionID with the ID of the transaction.

9.2. Reverting transactions

The following procedure describes how to revert a selected transaction or the last transaction using dnf.

Procedure

  • To revert a particular transaction, use:

    # dnf history undo transactionID

    Replace transactionID with the ID of the transaction.

  • To revert the last transaction, use:

    # dnf history undo last

Note that the dnf history undo command only reverts the steps that were performed during the transaction. If the transaction installed a new package, dnf history undo uninstalls it. If the transaction uninstalled a package, dnf history undo reinstalls it. The dnf history undo command also attempts to downgrade all updated packages to their previous versions, if the older packages are still available.

9.3. Repeating transactions

The following procedure describes how to repeat a selected transaction or the last transaction using dnf.

Procedure

  • To repeat a particular transaction, use:

    # dnf history redo transactionID

    Replace transactionID with the ID of the transaction.

  • To repeat the last transaction, use:

    # dnf history redo last

Note that the dnf history redo command only repeats the steps that were performed during the transaction.