How to undo the changes in Fedora

Today I want to consider rollbacks (rollback) by the DNF package Manager. Judging by the frequent questions on the forums a lot of users just don’t know all the possibilities of DNF. By default, it uses the distributions of the family of Red Hat or fork. Most users after installing and configuring systems call your favorite software. Some “cut out” all unnecessary in their opinion. Also a lot of software put on view, to compare it with peers and remove.

Not always system administration is completed correctly. Mistakes happen and crashes. Of the reasons I will not argue. Let me just note that there are no perfect systems and users. The same Fedora as well, and another system is very easy to break.

In this case there are different ways to backup or snapshots of the system (Silvrblue, OpenSUSE, etc.). And DNF package Manager provides a system of kickbacks. It’s certainly not a snapshot or backup, but something like Windows restore points. Subsequently, that I hope will help to save a lot of time and nerves.

Roll back changes in Fedora

For demonstration I am using Fedora 31-beta. For starters, update the system:

sudo dnf upgrade --refresh

Then check the system errors:

sudo dnf check

Checks the local packagedb and gives information about any found problems.

As you can see DNF gave an empty string, it means no problems found.
Next, look at the history:

sudo dnf history list

The history command allows the user to view the events of past transactions and act according to this information. By default, displays the whole list, you can also look for rooms or packages.

Then you can view the history of individual transactions:

sudo dnf history info

By default, prints the last can also be searched by number or the action, installed packages.

Here we should pay attention to the line:

Return code : Successful

Here we come to the actual kickbacks:

dnf history rollback number(package-name)

This command allows you to cancel all transactions made after the specified transaction. Here and below I use the numbers of the transactions (I prefer that), if it is not possible to cancel some of the transactions due to the current state of RPMDB(return Code), it will not cancel any transaction. It should be noted that kickbacks work with packages installed with DNF and PackageKit (Gnome-Software, Dnfdragora). Flatpage are managed separately.

For example, I will install a text editor Geany. Then roll back the installation:

sudo dnf history rollback 14

As you can see we rolled back all changes after the 14th of the transaction.
Also there are other options, use the history command:

dnf history redo n(package-name)

To repeat the specified transaction:

sudo dnf history redo 15

As you can see we’ve installed Geany:

dnf history undo number(package-name)

To cancel the specified transaction.

sudo dnf history undo 17

As you can see, we again removed Geany:

sudo dnf history userinstalled

Show all deb packages installed:

That’s the way with the DNF command – History you can roll back the system. Do them better on a stable system (in beta there may be problems). Fedora 31-beta was taken for the example as it was handy on the virtual machine. It is certainly not a complete replacement betapam, but often helps to get rid of the headaches.

Insights

Today, we reviewed the kickbacks through the package Manager from DNF. These and other team DNF more details can be found here, or in terminal using the command man.

Source: losst.ru

(Visited 18 times, 1 visits today)