My dnf is broken, please help!

Hi ! I try upgrad my Openmandriva 5.1.9-desktop-1omv4000 (4.0 to 4.1)

There was a problem during the upgrade and now DNF is not working. Each time they are covered by communication range.

Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
ModuleNotFoundError: No module named 'dnf'

It seems to me that the problem arose after upgrading python 3.7 to python 3.8

Please help.

To help we need more information. How did you attempt to upgrade from 4.0 to 4.1? Did you follow these instructions?

Post-edit: Looking at the error output I would start problem solving by copying this line:

and doing an internet search. Such a search will return plenty of results and some of them relate to upgrading python and some package like a python-dnf package missing. If that is the case you probably can fix this by manually downloading the package and installing it with rpm. To see what dnf related packages are installed is simple, just run this command ‘rpm -qa | grep dnf’ and post the results here as code (</> icon). This is from a working hardware OM Lx 4.1 system fully upgraded:

$ rpm -qa | grep dnf
python-dnf-4.2.18-1.noarch
lib64dnf2-0.43.1-1.x86_64
python-dnfdaemon-0.3.19-3.noarch
dnf-4.2.18-1.noarch
python-libdnf-0.43.1-1.x86_64
python-dnf-plugin-rpmconf-4.0.8-3.noarch
python-dnf-plugins-core-4.0.13-1.noarch
dnf-conf-4.2.18-1.noarch
python-dnf-plugins-extras-common-4.0.8-3.noarch
dnf-yum-4.2.18-1.noarch
dnf-automatic-4.2.18-1.noarch
dnf-plugins-core-4.0.13-1.noarch
dnfdaemon-0.3.19-3.noarch
dnfdragora-1.1.2-5.x86_64

Hello Ben! Thank you for the quick answer to my problem.
I made the update through “dnfdragora-update”, which resulted in a “java” error.

[root@st-korek skorek]# rpm -qa | grep dnf
dnf-plugins-core-4.0.7-1.noarch
dnf-automatic-4.2.6-1.noarch
dnf-conf-4.2.6-1.noarch
dnf-URPM-0-0.git20180418.2757451.3.noarch
dnfdaemon-0.3.19-2.noarch
lib64dnf2-0.33.0-1.x86_64
dnf-4.2.6-1.noarch
python-dnf-4.2.6-1.noarch
dnfdragora-updater-1.1.2-2.x86_64
python-libdnf-0.33.0-1.x86_64
python-dnfdaemon-0.3.19-2.noarch
dnfdragora-1.1.2-2.x86_64
python-dnf-plugins-core-4.0.7-1.noarch
[root@st-korek skorek]# 

In OM Lx dnfdragora or Discover do not have capability to do a distribution upgrade so that was never going to work. Can not use them to upgrade from one OM Lx version to another.

Problems like “My dnf is broken” usually involve a GUI package manager being used.

Notice any difference between your list and my list? This might work >>>I would start with going to main/release repository and download .rpm’s for dnf, python-dnf, dnf-conf, dnf-yum, dnf-automatic, and lib64dnf2 and try to install them with rpm. If rpm complains of any other dependency then download those and add them to the list until you can get them all to install without error.

To make installing those easier create a folder (say RPMS) and download all the .rpm’s to that folder then open Konsole and cd to that folder and install them with one command:

$ mkdir RPMS

then download the .rpm’s to this folder and:

$ cd RPMS

$ sudo rpm -Uhv *.rpm

If the result is an error about a missing dependency then download that package and add it to the list and keep on until the command is successful without any error.

Or you can do a fresh install of OM Lx 4.1 > this might be easier.

@Stan thanks for reporting this. It seems we did not adequately publish about this aspect of how Rock release works. We are working on that now.

Apologies to you or any user inconvenienced by this.

Hello BEN,
What versions must be the .rpm packages to install? Higher than those already in the system, do I have to remove them from the system first?

First I will try to install these packages, if the installation fails, I will install the omv4.1 version.

Thank you BEN.

No.

The versions for OM Lx 4.1 which are the versions from the list I posted:

$ rpm -qa | grep dnf
python-dnf-4.2.18-1.noarch
lib64dnf2-0.43.1-1.x86_64
python-dnfdaemon-0.3.19-3.noarch
dnf-4.2.18-1.noarch
python-libdnf-0.43.1-1.x86_64
python-dnf-plugin-rpmconf-4.0.8-3.noarch
python-dnf-plugins-core-4.0.13-1.noarch
dnf-conf-4.2.18-1.noarch
python-dnf-plugins-extras-common-4.0.8-3.noarch
dnf-yum-4.2.18-1.noarch
dnf-automatic-4.2.18-1.noarch
dnf-plugins-core-4.0.13-1.noarch
dnfdaemon-0.3.19-3.noarch
dnfdragora-1.1.2-5.x86_64

Download the packages from here and there won’t be but one version for each package. That is the actual main/release repository for OM Lx 4.1.

First be sure that when you run command:

$ dnf repolist

all the repositories listed say Rock. You must have at least these enabled:

It is OK if you have additional repositories as long as the are named Rock. Like this would be all normal Rock repos:

If upgrading the dnf package manually does get dnf working again go here and follow the instructions to properly upgrade 4.0 to 4.1.

[root@st-korek skorek]# dnf repolist
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.8/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.8/site-packages/dnf/base.py", line 31, in <module>
    from dnf.comps import CompsQuery
  File "/usr/lib/python3.8/site-packages/dnf/comps.py", line 27, in <module>
    from dnf.exceptions import CompsError
  File "/usr/lib/python3.8/site-packages/dnf/exceptions.py", line 22, in <module>
    import dnf.util
  File "/usr/lib/python3.8/site-packages/dnf/util.py", line 30, in <module>
    import dnf.callback
  File "/usr/lib/python3.8/site-packages/dnf/callback.py", line 22, in <module>
    import dnf.yum.rpmtrans
  File "/usr/lib/python3.8/site-packages/dnf/yum/rpmtrans.py", line 26, in <module>
    import rpm
ModuleNotFoundError: No module named 'rpm'

Hello BEN,
I installed all the packages that the system required and there is still a problem with dnfdragor.

[root@st-korek skorek]# dnfdragora
Traceback (most recent call last):
  File "/usr/bin/dnfdragora", line 47, in <module>
    from gi.repository import GLib
ModuleNotFoundError: No module named 'gi'

Then let’s quit trying to fix this.

I would suggest at this point for you to do a fresh install.

I do not recommend using dnfdragora or Discover or any GUI package manager for upgrading system in OpenMandriva. Doing system upgrades from command line is very easy and saves time in the long run. Another benefit is user tends to start learning some things that keep them from breaking things.

Thank you BEN for your help.