How to recover a broken Dnf? after installing keras

Hi, new user here!
I am currently on Fedora 28.
So I wanted to install Keras (lib for neural networks) so I followed this tutorial: MNIST Handwritten Digit Recognition in Keras - Nextjournal
Which uses conda that I downloaded. Then I downloaded keras using pip. (I’m describing everything because I don’t know when the problem happened). From that moment, dnf has stopped working and I suspect that conda has changed dnf’s dependencies…
I get the following log:

dnf             
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 31, in <module>
    import dnf.base
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 26, in <module>
    from dnf.comps import CompsQuery
  File "/usr/lib/python3.6/site-packages/dnf/comps.py", line 29, in <module>
    import dnf.util
  File "/usr/lib/python3.6/site-packages/dnf/util.py", line 32, in <module>
    import librepo
  File "/usr/lib64/python3.6/site-packages/librepo/__init__.py", line 1077, in <module>
    import librepo._librepo
ImportError: /lib64/libcurl.so.4: symbol SSLv3_client_method version OPENSSL_1_1_0 not defined in file libssl.so.1.1 with link time reference

I have no idea how to fix that, can anyone help on that issue?
Thanks in advance!

Hello @arthamios—welcome to the community! Please take a minute to go through the posts in #start-here here if you haven’t already.

A few questions:

  • normally, ananconda is installed in your user directory (~/) so that it doesn’t interefere with system files—is that the case here?
  • similarly, when you installed keras with pip, was it installed in the anaconda environment so that it did not interfere with the system’s python installation?

If conda and pip did not touch the system python installation, which they normally don’t, all you have to do is deactivate the conda environment that you’re running, and then dnf should run just fine.

When a conda environment is activated, conda simply mangles python paths so that its files are visible before the system-wide python installation.

Hello @FranciscoD, thanks! I did

On my computer it is installed in /usr/sbin, /usr/libexec and /usr/share (that’s what whereis told me)

However, even if Keras is installed, I don’t know where it is, the download process did not specify where it was installed, can you explain how to know that?

Same way, I have never used conda, I don’t really know what it is, so I don’t know what you mean by deactivating it…

Thank you for your answer!

How did you install anaconda?

When you used pip to install it, did you use sudo? If you did not, it should not have touched system files.

Ah, you should read up on it a bit—it’s a good tool, but you need to understand how it works if you want to use it well.

Generally, when you install anaconda and use it to install packages, it does so in a new environment—to ensure that it doesn’t mess with your system’s python installation. So, you can have multiple conda environments and install different packages and use different versions of python. It’s a slightly advanced version of python virtual environments.

However, when you activate an environment, conda loads its files—which may not match and work with the system python. dnf needs system python and system libraries—it may not work with the conda packages.

Take a look at this page to understand conda environments. It’ll tell you how to list them, how to activate them, how to deactivate them. I suspect deactivating your current environment should hopefully fix your issue (if the sytem files were not messed up by installing conda initially):

https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Mh I don’t remember having installed it manually, so it either was on my computer natively or was installed as a dependency. I’m almost never using python, but when I do I use Pycharm, maybe it installed it.

Yes I was root

Ok I think I understand now thank you!

Thanks, I’ll look into that!

1 Like

Uh—that’s unfortunate. Depending on what pip has touched, the system may or maynot be fixable :slightly_frowning_face:

Well I thought that stuff like pip were not supposed to be designed to break your system

No, pip makes no such claims. It is simply a tool to install packages from PyPi. How and where these are installed is left up to the user.

This is the usecase that anaconda and python virtual environments aim to address. Every user, with or without sudo access can create a new virtual environment in their home folders and install whatever packages they wish without interacting with the system-wide python installation at all. They can have multiple virtual environments too—so you can have one for keras, another for another tool—all independent of each other. When using root in general, you should be more careful to see what’s being done.

Does dnf work at all? What is the output of:

rpm -qa \*dnf\* \*repo\*

?

Let’s see if we can reinstall it etc to fix it.

Mh ok so it messed up the environment that dnf’s python files are using I guess.

I got the usage of RPM:

RPM version 4.14.2.1
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

after that there is the list of flags available
However it produces the exit code 4

I suspect deactivating your current environment should hopefully fix your issue (if the sytem files were not messed up by installing conda initially):

Well, that did not work unfortunately…:
conda deactivate
dnf
Traceback (most recent call last):
File "/usr/bin/dnf", line 57, in <module> from dnf.cli import main
File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 31, in <module>
import dnf.base
File "/usr/lib/python3.6/site-packages/dnf/base.py", line 26, in <module>
from dnf.comps import CompsQuery
File "/usr/lib/python3.6/site-packages/dnf/comps.py", line 29, in <module>
import dnf.util File "/usr/lib/python3.6/site-packages/dnf/util.py", line 32, in <module>
import librepo
File "/usr/lib64/python3.6/site-packages/librepo/__init__.py", line 1077, in <module>
import librepo._librepo
ImportError: /lib64/libcurl.so.4: symbol SSLv3_client_method version OPENSSL_1_1_0 not defined in file libssl.so.1.1 with link time reference

I guess removing conda would do the trick, but then I would not know how to reinstall it properly

Yes, possibly the system-wide python installation that dnf and other tools rely on. But we’ll see :slight_smile:

Are you sure you ran the command correctly? (Copy pasting should work). I get the expected results here.

No, it won’t unfortunately—removing conda will not bring back the files that were overwritten—but we don’t know if that’s the issue yet.

Can you try this modified command again please?

rpm -qa \*dnf\* \*repo\* \*ssl\*

The output of uname -a would also be useful.

I looked at this page. One or two things of note:

  • it does not seem to require the use of sudo at all, so you shouldn’t use it if you install keras again.
  • it installs a version of openssl different from the fedora version. So, if you used sudo and it overwrote the system version, that could be the cause of the error you are seeing.

The output of

rpm -qa \*dnf\* \*repo\* \*ssl\*

will tell us more.

At first I did not use sudo, but the first step failed because it needed to write in a write-protected directory, so I had to use sudo (which I kept using).

Sorry… used -sa instead of -qa, here is the result:

dnf-2.7.5-12.fc28.noarch
libreport-plugin-systemd-journal-2.9.5-3.fc28.x86_64
libreport-filesystem-2.9.5-3.fc28.x86_64
createrepo_c-libs-0.10.0-19.fc28.x86_64
python3-dnf-plugins-core-2.1.5-4.fc28.noarch
python3-dnf-plugins-extras-common-2.0.5-3.fc28.noarch
python3-libreport-2.9.5-3.fc28.x86_64
python3-librepo-1.8.1-7.fc28.x86_64
libreport-plugin-kerneloops-2.9.5-3.fc28.x86_64
python3-dnf-plugin-system-upgrade-2.0.5-3.fc28.noarch
libreport-web-2.9.5-3.fc28.x86_64
libdnf-0.11.1-6.fc28.1.x86_64
libreport-plugin-bugzilla-2.9.5-3.fc28.x86_64
fedora-repos-28-7.noarch
dnf-plugins-core-2.1.5-4.fc28.noarch
libreport-plugin-ureport-2.9.5-3.fc28.x86_64
python3-dnf-2.7.5-12.fc28.noarch
dnf-yum-2.7.5-12.fc28.noarch
libreport-plugin-logger-2.9.5-3.fc28.x86_64
libreport-2.9.5-3.fc28.x86_64
dnfdaemon-selinux-0.3.18-6.fc28.noarch
libreport-gtk-2.9.5-3.fc28.x86_64
dnf-conf-2.7.5-12.fc28.noarch
createrepo_c-0.10.0-19.fc28.x86_64
dnfdaemon-0.3.18-6.fc28.noarch
libreport-anaconda-2.9.5-3.fc28.x86_64
python2-repoze-lru-0.4-17.fc28.noarch
libreport-cli-2.9.5-3.fc28.x86_64
librepo-1.8.1-7.fc28.x86_64
libreport-plugin-reportuploader-2.9.5-3.fc28.x86_64
dnfdragora-1.1.1-1.fc28.noarch
claws-mail-plugins-spam-report-3.16.0-1.fc28.x86_64
python3-dnfdaemon-0.3.18-6.fc28.noarch
libreport-fedora-2.9.5-3.fc28.x86_64

And the one for rpm -qa \*dnf\* \*repo\* \*ssl\*:

dnf-2.7.5-12.fc28.noarch
libreport-plugin-systemd-journal-2.9.5-3.fc28.x86_64
libreport-filesystem-2.9.5-3.fc28.x86_64
createrepo_c-libs-0.10.0-19.fc28.x86_64
python3-dnf-plugins-core-2.1.5-4.fc28.noarch
openssl-1.1.0i-1.fc28.x86_64
mingw64-openssl-1.0.2h-6.fc28.noarch
python3-dnf-plugins-extras-common-2.0.5-3.fc28.noarch
python3-libreport-2.9.5-3.fc28.x86_64
python3-librepo-1.8.1-7.fc28.x86_64
libreport-plugin-kerneloops-2.9.5-3.fc28.x86_64
openssl-libs-1.1.0i-1.fc28.x86_64
python3-dnf-plugin-system-upgrade-2.0.5-3.fc28.noarch
libreport-web-2.9.5-3.fc28.x86_64
docbook-style-dsssl-1.79-25.fc28.noarch
libdnf-0.11.1-6.fc28.1.x86_64
libreport-plugin-bugzilla-2.9.5-3.fc28.x86_64
compat-openssl10-pkcs11-helper-1.22-4.fc28.x86_64
fedora-repos-28-7.noarch
dnf-plugins-core-2.1.5-4.fc28.noarch
libreport-plugin-ureport-2.9.5-3.fc28.x86_64
python3-dnf-2.7.5-12.fc28.noarch
dnf-yum-2.7.5-12.fc28.noarch
apr-util-openssl-1.6.1-8.fc28.x86_64
libreport-plugin-logger-2.9.5-3.fc28.x86_64
NetworkManager-fortisslvpn-gnome-1.2.8-2.fc28.x86_64
libreport-2.9.5-3.fc28.x86_64
dnfdaemon-selinux-0.3.18-6.fc28.noarch
libreport-gtk-2.9.5-3.fc28.x86_64
mingw32-openssl-1.0.2h-6.fc28.noarch
dnf-conf-2.7.5-12.fc28.noarch
xmlsec1-openssl-1.2.25-4.fc28.x86_64
createrepo_c-0.10.0-19.fc28.x86_64
dnfdaemon-0.3.18-6.fc28.noarch
compat-openssl10-1.0.2o-1.fc28.x86_64
libreport-anaconda-2.9.5-3.fc28.x86_64
openssl-pkcs11-0.4.8-2.fc28.x86_64
python2-repoze-lru-0.4-17.fc28.noarch
libreport-cli-2.9.5-3.fc28.x86_64
librepo-1.8.1-7.fc28.x86_64
libreport-plugin-reportuploader-2.9.5-3.fc28.x86_64
dnfdragora-1.1.1-1.fc28.noarch
openssl-devel-1.1.0i-1.fc28.x86_64
claws-mail-plugins-spam-report-3.16.0-1.fc28.x86_64
python3-dnfdaemon-0.3.18-6.fc28.noarch
NetworkManager-fortisslvpn-1.2.8-2.fc28.x86_64
rubygem-openssl-2.1.2-95.fc28.x86_64
libreport-fedora-2.9.5-3.fc28.x86_64
python2-backports-ssl_match_hostname-3.5.0.1-8.fc28.noarch

And uname -a:

Linux linux.home 5.0.7-100.fc28.x86_64 #1 SMP Mon Apr 8 16:46:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I am thinking about reinstalling the whole OS… But before that I might try reinstalling dnf or python, might fix it. Do you have any other solution @FranciscoD ?

Can you please do the following?:

download dnf from koji : dnf 2.7.5-12

and then:

sudo rpm -ivh *.rpm

NOTE: Please don’t use this as your day to day tool

REMEMBER : Fedora 28 will be EOL on Tuesday, May 28th, 2019 - #2

Regards.,

1 Like

Done, but the installation had a warning:

sudo rpm -ivh dnf-2.7.5-12.fc28.src.rpm 
Updating / installing...
dnf-2.7.5-12.fc28                warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
################################# [100%]

I still have the same issue as before…

Why not? Isn’t that dnf?

Well I am usually using dnf to update to the newer version of fedora, so…

You download the source, you have to download this packages:

then execute, this command to reinstall dnf, you need all of this for dependency problem:

sudo rpm -ivh *.rpm

After this, try to use dnf

Regards.,

NOTE: however is only a warning.

1 Like

There is also a tool: koji (sudo dnf install koji).
Then you can download the various RPMs associated with a build (the number you can see in the web page).

cd ~/Downloads && koji download-build -a noarch 1073265

1 Like

@alciregi good to know but his/her dnf is broken

1 Like

whoops, right right :sweat:

2 Likes