So I installed a bunch of packages, and I want to go “back to the start.” Is there a “hey dnf uninstall everything apart from the base os” command?
Hi @jjasghar , welcome to the community.
No, as far as I know, there isn’t really a “go back to the start” command, unfortunately. What one can do however, is look at the dnf
history and undo transactions or uninstall packages.
sudo dnf history list
sudo dnf history undo <transaction>
Ah so maybe there needs to be some grep
and awk
magic to the history list. Let me see if i can figure that out.
You can undo the installs in reverse order to how you installed them.
No need to grep and awk a list of packages.
It seems my dnf history list
doesn’t have everything because i did some post (initial) provisioning with ansible
, and it’s offiscated too it seems. This was very suprising, and it seems the “best way forward” is actually to just reinstall the machine.
I really thought there was a way to “set back to 0” way.
Depending on the filesystem (btrfs) you use, you can make snapshots, this way you can go back if needed.
Yep, that was what another friend said on another conversation. I guess I learned a lesson here.
If this is something you think you might do often, maybe look at the Atomic Fedora flavors. It can do exactly what you’re looking to do with rpm-ostree reset
.
Packages installed via dnf often have dependencies which may change over a number of system updates. This situation can complicate things if the goal to to revert to the way things were at some time in the past.
One way to mitigate this risk is to archive an umounted distro using a tool to archive that is running on a separate distro before making changes. Restoring from the archive will revert back to the condition just before the unmounted distro was archived.
I strongly second this.