Accidents can happen at any time on a computer system. Some small, some painfully large. One of such accidents can be removing or installing packages in Linux and it causing havoc in your system. This is when knowing about DNF | YUM History can help you out. This article was originally written years ago on a previous blog of mine. I am adding it back here so others can see how to use
The DNF remove command
When you run a DNF remove command it does list all the packages and dependencies that are going to be removed and gives you the opportunity to abort. The problem can come into play if you get too complacent and just hit yes, or are just unaware of the impact of the removal of some of those packages on your system. I had such an incident while troubleshooting audio issues on my Fedora 23 system. The audio just wouldn’t play, and I thought about removing
Restoring using DNF History
I wasn’t too worried as I can get around in the command line just fine, but I still wanted my GUI for other reasons as this is a home workstation, not a server. I recalled a command from my Red Hat training that proved to be very useful in this situation. DNF History (yum history for CentOS and Red Hat).
You will need to be logged on as root to perform this action of course. If it won’t fit on the screen just type the command
The system came up without incident and the Gnome GUI loaded as it did before I broke the system. The moral of the story is to first pay attention to what is being removed and to make sure that is REALLY okay. It is nice to know that the DNF history command is there however, and at some point you just may need to use it.