Select Page

How to Rollback Changes with the DNF History Command

Cyberdime
Published: November 6, 2022

There’s many reasons to love Linux, such as its package management and the incredible amount of software at your fingertips. One such package manager is DNF, which is used by several Linux distributions like Red Hat, Fedora, and CentOS. DNF, often referred to as Dandified YUM, is an updated version of the YUM package manager, and it provides several improvements over its predecessor. These include reduced memory usage, more efficient dependency resolution, and increased performance. 

What is the DNF history command?

Among the many uses of the DNF command, like installing and upgrading software, is the ability to interact with past transactions using the dnf history command. The DNF history command will allow you to view all the transactions that have been made using DNF and interact with them. 

What is the DNF history rollback command?

This helpful feature includes the ability to rollback changes using the dnf history rollback command. This command will undo all transactions performed after the specified transaction. The transaction can be specified using a transaction specification, which is the ID number given to the transaction based on when it occurred. 

Another way to specify the transaction is with the package file specification, which is essentially the name of the package (more specifically the name, epoch, version, release, and architecture commonly known as NERVA). If more than one transaction is found for the given package file specification, it will use the latest transaction. Using the transaction ID ensures that the correct transaction is selected. 

What is the difference between DNF history rollback and undo commands? 

The difference between DNF history rollback and undo commands is that undo is used for a single transaction, whereas rollback is used to undo all the transactions that have occurred after the specified transaction. Both commands are great to have in your toolkit but have different use cases. 

How do you use the DNF history rollback command? 

Let’s walk through an example to illustrate how the DNF history rollback works:

sudo dnf history –reverse

Source: www.pluralsight.com