I think quite a lot of users know the situation when you are unable to boot or run a system due to broken upgrade or problems created from the keyboard site. Recently I experience combination of both, but what then? First idea was to take out hard disk and connect it into working system, but then better idea appeared. The Fedora is delivered on boot-able live CD and I remembered that somewhere I have one. But will it work, and can I repair Fedora 25 from Fedora 23 live CD? Lets see what happened.
After booting from CD I checked if I can see the hard disk with broken system. I open from Activities application called Files and in “Other Locations” I opened the disk with Fedora 25. Data were there and I was happy that at least something is working. Now I moved my attention to terminal. I know that if I want to do repair I have to upgrade DNF of running system into DNF-2.0 from dnf-nightly repository on copr and I did (‘dnf copr enable rpmsoftwaremanagement/dnf-nightly’ then ‘dnf upgrade dnf’). The reason to do that was that dnf-2.0 provides many patches for installroot and additionally it provides commands like check or option –duplicates for remove command that are pretty handy for repair of the system.
The next question was how to find path to my broken system in terminal. I have seen that I have some directories with unique names (say crazy names) in root dir and I searched for them by ‘sudo find / -name <name_dir> ‘ or if you don’t have such, it is possible to create it in tmp/ dir on disk that you search for by Files, because for that directory you don’t need any special permission. From this research I got the path for –installroot option.
Consequently I was able to begin with repair. First I tried repolist command if I can see repositories of my original system and if releasever is correctly detected. Another good news, the command ‘dnf –installroot=/<path/to/disk> repolist‘ worked like expected. I know that accidentally I removed one package required by selinux and I successfully installed it by ‘dnf –installroot=/<path/to/disk> install selinux-policy-targeted‘. Then I started with removing of duplicates discovered by command ‘dnf –installroot=/<path/to/disk> check‘. The first attempt was with command ‘dnf –installroot=/<path/to/disk> remove –duplicates‘ but it didn’t work because I had some duplicates with unsatisfied dependencies, therefore it tried to remove too many packages. Therefore I continued with remove of each of duplicates by ‘dnf –installroot=/<path/to/disk> remove ‘. But this time I was very careful to not remove something that I don’t want, because for first time I tried to remove duplicate of selinux-policy and I remove the only copy that had installed all dependencies and kept the version that don’t have selinux-policy-targeted.
Last problems that remain on my system were duplicates of dnf and python3-dnf, but I was unable to remove them with information: Error: The operation would result in removing the following protected packages: dnf. Well here helped rpm (‘rpm -e ‘). Then I did upgrade of the system and everything looked good. It was the point when I tried if the system was repaired – reboot. And the system was again alive. The last question was if all packages were installed correctly from primary cause of the story – broken upgrade. I decided to do the last step, reinstall of all packages by “dnf reinstall ‘*’ ”.
This is the end of the story, my system works again due to Live CD technology and DNF-2.0.
Long live to Fedora and DNF.