My dnf is broken, please help!

Hi ! I upgraded my fedora 28 to 29.
(I did follow https://fedoramagazine.org/upgrading-fedora-29-to-fedora-30/ but changed --releasever=30 to 29, was this correct ?)
My packages seems to have upgraded sucessfully e.g I am on linux 5.2.

BUT DNF IS BROKEN:
it always output

Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 27, in <module>
    from dnf.const import VERSION
  File "/usr/lib/python3.7/site-packages/dnf/const.py", line 22, in <module>
    import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils'

I don’t know what to do!
but hey I felt adventurous, so I commented the use of distutils in const.py (dnf code !)
but it show (create ?) this new error:

Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.7/site-packages/dnf/base.py", line 29, in <module>
    import libdnf.transaction
ModuleNotFoundError: No module named 'libdnf'

I did try to reinstall dnf with:

rpm --reinstall python3-dnf-xxxxxx.rpm
``` for pyhton 3 and 2 of https://koji.fedoraproject.org/koji/buildinfo?buildID=1319774

My PC can't update until someone save my day.
1 Like
sudo dnf-2 distrosync

https://bugzilla.redhat.com/show_bug.cgi?id=1599069

2 Likes

thanks but I believe this is not the same issue, he had two python 3 intsalled, while
rpm -q dnf python3-dnf python3 python3-rpm

give me one python version:
dnf-4.2.5-3.fc29.noarch
python3-dnf-4.2.5-3.fc29.noarch
python3-3.7.4-1.fc29.x86_64
python3-rpm-4.14.2.1-2.fc29.x86_64

sudo dnf-2 distrosync is an unknown command on my fedora

how can I downgrade python to 3.6.5 without using dnf ??
should I make a symlink ? how ? I never did one

for running sudo dnf-2 distrosync
I need /usr/bin/dnf-2 but it is not installed
I downloaded python2-dnf-4.2.5-3.fc29.noarch.rpm

BUT sudo rpm --reinstall python2-dnf-4.2.5-3.fc29.noarch.rpm
output me
erreur : DĂ©pendances requises:
python2-gpg est nécessaire pour python2-dnf-4.2.5-3.fc29.noarch
python2-hawkey >= 0.31.0-4 est nécessaire pour python2-dnf-4.2.5-3.fc29.noarch
python2-libcomps >= 0.1.8 est nécessaire pour python2-dnf-4.2.5-3.fc29.noarch
python2-libdnf est nécessaire pour python2-dnf-4.2.5-3.fc29.noarch
python2-libdnf >= 0.31.0-4 est nécessaire pour python2-dnf-4.2.5-3.fc29.noarch

how can I solve this ?

it’s a dependency hell, I try to sudo rpm --install python2-gpg-1.11.1-3.fc29.x86_64.rpm
but it output
erreur : DĂ©pendances requises:
gpgme(x86-64) = 1.11.1-3.fc29 est nécessaire pour python2-gpg-1.11.1-3.fc29.x86_64

i have now this error sudo rpm --install gpgme-1.11.1-3.fc29.x86_64.rpm
le paquet gpgme-1.12.0-1.fc29.x86_64 (plus récent que gpgme-1.11.1-3.fc29.x86_64) est déjà installé
le fichier /usr/bin/gpgme-json de l’installation de gpgme-1.11.1-3.fc29.x86_64 entre en conflit avec le fichier du paquet gpgme-1.12.0-1.fc29.x86_64
le fichier /usr/lib64/libgpgme.so.11 de l’installation de gpgme-1.11.1-3.fc29.x86_64 entre en conflit avec le fichier du paquet gpgme-1.12.0-1.fc29.x86_64
le fichier /usr/share/doc/gpgme/AUTHORS de l’installation de gpgme-1.11.1-3.fc29.x86_64 entre en conflit avec le fichier du paquet gpgme-1.12.0-1.fc29.x86_64
le fichier /usr/share/doc/gpgme/ChangeLog de l’installation de gpgme-1.11.1-3.fc29.x86_64 entre en conflit avec le fichier du paquet gpgme-1.12.0-1.fc29.x86_64
le fichier /usr/share/doc/gpgme/NEWS de l’installation de gpgme-1.11.1-3.fc29.x86_64 entre en conflit avec le fichier du paquet gpgme-1.12.0-1.fc29.x86_64
le fichier /usr/share/doc/gpgme/VERSION de l’installation de gpgme-1.11.1-3.fc29.x86_64 entre en conflit avec le fichier du paquet gpgme-1.12.0-1.fc29.x86_64

so I need not fedora 29 packages but fedora 29 update packages, is that normal ?
http://rpmfind.net/linux/rpm2html/search.php?query=gpgme

You can search the packages and get the download links here:
https://fedora.pkgs.org/
You need the latest package versions from the updates repository.

1 Like

thanks, I did this that was epic ^^
And
 it WORKS ! Through a zsh alias (is that a symlink ?) I can now use dnf (dnf-2 actually) so thank your for everything!
BUT I would like to have dnfagora (dnf GUI) to work again, how can I tell to dnfagora to use /usr/bin/dnf-2 instead of 3 ??

BTW do you think it is safe for me to update fedora to 30 despite my dnf3 not working ? ^^ could the problem fixe by himself ?

The best way is to fix the original issue.
Check the output:

sudo rpm --rebuilddb
sudo dnf-2 clean all
sudo dnf-2 check all
sudo dnf-2 repolist
sudo dnf-2 distrosync
1 Like

well thank you again for the effort, but my dnf-3 is still broken after applying your commands with dnf2

output:

/usr/bin/dnf-3 
Traceback (most recent call last):
  File "/usr/bin/dnf-3", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.7/site-packages/dnf/__init__.py", line 27, in <module>
    from dnf.const import VERSION
  File "/usr/lib/python3.7/site-packages/dnf/const.py", line 22, in <module>
    import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils'

python -V give me
Python 2.7.16
is that normal ?

I actually tried to upgrade to fedora 30 but this is not allowed with dnf-2

So, your upgrade didn’t go through properly. A complete upgrade would not have caused this. Even though you’ve got dnf-2 working, your system is not in a correct state.

Can you please paste the output of:

rpm -qa \*python\*

We want to look at ALL the python packages you have installed. Then we can compare it with a correct, complete installation. That will give us some ideas on what’s missing.

Can you also paste the output of:

fpaste --sysinfo --printonly

That’ll give us some general information about your installation.

1 Like

Here too, we’ve not really established why this module is not found by dnf yet—and it still doesn’t work.
It’s a core python module which indicates some major issues with the installation.

So we really shouldn’t suggest fixes yet. Let’s understand what the issue is first, and then suggest fixes. This applies to all issues. Please DO NOT suggest fixes just for the sake of getting it to work–it could make things worse if the issue has not been understood to begin with.

This is the right order of doing things:

  • see error message
  • get more information on issue
  • isolate cause of issue
  • suggest fixes to treat core issue

Not:

  • see error message,
  • suggest fix “to get things working” without confirming what is causing the error.

The error is merely a symptom. Correcting or working around it is not enough—as you can see here. Let us be more careful from now on.

3 Likes

No it is not. Python3 is default now. Hence, your system is broken and has issues that we need to fix. SImply using dnf-2 is not the solution here.

Those are diagnostic commands to collect more information about the system state and the issue.
And I asked the output:

2 Likes

Sorry @vgaetera, this isn’t meant directly for you but as a general comment. I’ll write it up as a separate announcement post when I find the time. In general, folks helping on the forum should explain what they are saying and why so that the reporter has a clear idea of what may be wrong and what steps are being followed to fix it.

The idea is that this should’ve been the first reply, before anything else was suggested. Let’s wait for @help666 to provide more information before we provide any more suggestions now.

1 Like

Anyone is free to join the this discussion, but nobody suggested anything better for 3+ days.
Take into account that time is the most important resource for some people.
It may take several days to solve the original issue and not everyone is ready to wait for so long with no working package manager.
Meanwhile we can temporary mitigate the problem using dnf-2 and continue the troubleshooting.
But if we strictly follow the general algorithm, the troubleshooting becomes harder and we have no fallback instruments.


@FranciscoD, please, be more lenient, this is not a bug tracker and we are not some employed workers.
In my opinion, anyone is free to speak as long as it complies with the guidelines of the forum.
Too much regulation may negatively affect the community.

3 Likes