dnf autoremove killed my installation

asked 2016-02-24 08:48:50 -0500

braindraingame gravatar image

updated 2016-02-25 09:37:05 -0500

Hello everyone,

while fiddling around with fedora23 to get virtualbox running for a win10 VM, I found out I had to do a re-install of it. So, I thought, lets clean up other stuff I don't need, because I had installed quite a bit of unused stuff during that. Now, I did a very dumb thing: sudo dnf autoremove Then another dumb one: y ENTER without checking what exactly it removed. I was thinking: well, I installed everything through DNF, except for a hand full of third-party applications, it can't be that bad.

HUGE mistake. Going casually through the list of removed stuff, I realized firefox was in there (of which I even had a window up and runnung). Intrigued, I checked again and found that basically 90% of my installed packages were a goner. So what to do? I re-installed most of the stuff I thought to be required (including stuff like grub2!!!!) and hoped I slipped through.

But I didn't. After rebooting I am stuck in the UEFI MOK selection window and none of the hashes are working. It should be noted, that secure boot is disabled in the BIOS/UEFI. Booting from a live-ISO, i can still see my existing fedora installation (which btw. is encrypted with LUKS). But I have no idea how to boot from it or how to recover it. It seems dnf has wiped my whole installation, INCLUDING configurations for grub2 and possibly the kernel.

Is there a way to recover? Or am I faster just re-installing? I have a backup of almost everything, so not much lost, but seriously what is it with DNF autoremove?

Any help is appreciated!

PS: (just my 2 cents): autoremove is outreageously dangerous for anyone coming from apt or other package management tools. I don't know the name of every single library working in the background of some applications, and I don't want to learn about them, which is why I expect DNF autoremove to not purge packages which I required 1 hour earlier to boot my machine. That command should be removed or an extra warning should be shown when using it.


UPDATE: As my attempts at re-enabling boot for my destroyed installation of Fedora 23 failed, my solution was a complete re-install.

Unfortunately, I cannot reproduce the "destroy my system"-autoremove on my fresh install using,

sudo dnf list autoremove

which is why a bug report in that direction would go without evidence.

Looking a bit further, the DNF documentation for autoremove says ( http://dnf.readthedocs.org/en/latest/... ):

Packages listed in installonlypkgs are never automatically removed by this command.

And under the respective config documentation of installonlypkgs ( http://dnf.readthedocs.org/en/latest/... ):

List of provide names of packages that should only ever be installed, never upgraded. Kernels in particular fall into this category. These packages are never removed by dnf autoremove even if they were installed as dependencies (see clean_requirements_on_remove for auto removal details). The number of kept ...

(more)
edit retag flag offensive close merge delete

Comments

Reinstall will be you best option on this case. DNF autoremove is used normally when you want to remove a package and all its dependecies, have no previus experience with it. But looks like you did not choose correctly the option by not checking the package to remove list. Best luck next time.

aeperezt gravatar imageaeperezt ( 2016-02-24 09:26:37 -0500 )edit
2

dnf keeps a database with all transactions. So, one or two commands can just revert what you did previously wrong.

sudo dnf history

lists all previous transactions

sudo dnf undo <transaction-ID>
florian gravatar imageflorian ( 2016-02-24 10:49:35 -0500 )edit
1

@aeperezt The documentation for autoremove says:

Removes all “leaf” packages from the system that were originally installed as dependencies of user-installed packages but which are no longer required by any such package.

That is really far from reality obviously, but I guess its my fault for not double-checking what it would do.

Thank you for this @Florian. The transaction feature sounds helpful, I will keep that in mind. The correct command, however, is sudo dnf history undo <transaction-spec>.

braindraingame gravatar imagebraindraingame ( 2016-02-25 09:02:13 -0500 )edit

Oh, yes, messed that up. sudo dnf history undo <transaction-id> is right. Can't edit my previous comment to correct it.

florian gravatar imageflorian ( 2016-02-25 20:09:22 -0500 )edit