Description of problem: If a system hangs or is hard-restarted by user for some reason during dnf install, upgrade or any other active operation, rpm db is broken. This causes many packages to simply disappear from the list of installed packages and causes other issues that cannot be solved without a system reinstall. Running "rpm --rebuilddb" does not help. The only way how to probably solve this without an OS reinstall is by restoring a manually created backup of the rpm db. Version-Release number of selected component (if applicable): dnf-2.6.2-1.fc26.noarch rpm-4.13.0.1-5.fc26.x86_64 How reproducible: Every time. Steps to Reproduce: 1. Run: dnf install <package> 2. Power off the system during the installation process. Actual results: Broken rpm db, many system packages showing as not installed, "rpm -qa" command showing db errors. Expected results: Minor issues that can be fixed by reinstalling the previously installed package and its dependencies or by running "rpm --rebuilddb". Additional info: Clean install of Fedora 26. Happened to me two times, first when an issue with a nouveau graphic driver caused my system to hang during dnf install, then when system hanged when installing a probably broken package. I was also able to replicate this issue by restarting a virtual machine with Fedora 26 when it was doing a dnf upgrade.
Well, what dnf can do? Keep you system running even you disabled power? ;)
So, you really think that destroying a rpm db without any possibility to fix it (no, "rpm --rebuilddb" does not help at all) without an OS reinstall every time system freezes during dnf install/upgrade (because of bad package etc.) is a correct behavior?
I do understand your point and here is what DNF can do for you. First of all you can try to remove duplicated packages using ``dnf remove --duplicates``. I also create a patch that enhance capability if that command (https://github.com/rpm-software-management/dnf/pull/880). The command `` dnf check`` could discover problems on your system. and then reinstalling packages to bring missing requirements, or removal of duplicates could help. Also it is possible to restore your system using installroot. See my article here http://dnf.baseurl.org/2016/12/15/repair-of-broken-system-with-dnf-2-0/ . In future I have a plan to implement offline upgrade during reboot, that should be less sensitive to packaging problems. Additionally I would like to implement functionality to automatically finish unfinished transaction. Hope that it helps.
> is a correct behavior? yes, it is. You could look on Fedora Atomic that does atomic updates, so either you get new image or you don't. No intermediate steps.