Manually reinstall/rebuild/repair DNF/YUM

My computer froze in the middle of a DNF update and now DNF does not work and Yum does not exist on my system. When I try to do anything with yum I get “command not found” and when I try to do anything with DNF I get:

write_main() failed to re-load written solv file

The dnf.log tells me:

2019-11-11T17:50:17Z DEBUG repo: using cache for: fedora-modular                                                                                                                                           
2019-11-11T17:50:17Z DEBUG not found deltainfo for: Fedora Modular 28 - x86_64                                                                                                                             
2019-11-11T17:50:17Z DEBUG not found updateinfo for: Fedora Modular 28 - x86_64                                                                                                                            
2019-11-11T17:50:17Z SUBDEBUG                                                                                                                                                                              
Traceback (most recent call last):                                                                                                                                                                         
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 115, in cli_run                                                                                                                            
cli.run()                                                                                                                                                                                              
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1015, in run                                                                                                                                
self._process_demands()                                                                                                                                                                                
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 768, in _process_demands                                                                                                                    
load_available_repos=self.demands.available_repos)                                                                                                                                                     
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 475, in fill_sack                                                                                                                              
self._add_repo_to_sack(r)                                                                                                                                                                              
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 147, in _add_repo_to_sack                                                                                                                      
load_updateinfo=True)                                                                                                                                                                                  
OSError: write_main() failed to re-load written solv file                                                                                                                                                  
2019-11-11T17:50:17Z CRITICAL write_main() failed to re-load written solv file                                                                                                                             
2019-11-11T17:50:17Z DDEBUG Cleaning up. 

I would like to re-install DNF manually, however, I am using Fedora 28 and I cannot find a DNF version below fedora 29. When I try to use RPM to install a later version of DNF, there are loads and loads of python dependencies that need to be manually downloaded.

Is there anyway to repair dnf or yum without having to manually install dozens of other dependencies?

2 Likes

The .solv files live in /var/cache/dnf. Normally I wouldn’t suggest deleting files at random, but since these are cache files it’s actually safe to. The consequence is that they need to be re-downloaded. Since it seems like maybe the problem is that one of them is corrupt, that’s okay. So:

sudo rm -rf /var/cache/dnf/*

Since that’s a dangerous rm -rf, make sure to check the command twice before executing.

There’s a reasonable chance that DNF will start working after this.

1 Like

Please, post the output:

sudo rpm --verify --all