Error after installing dnf on CentOS 7

Installed dnf according to these instructions:

yum install epel-release -y
yum install dnf

after that dnf --version works fine but dnf repolist or anything else gives:

Extra Packages for Enterprise Linux 7 - x86_64  668 kB/s | 9.4 MB     00:14
Failed to open: /var/cache/dnf/x86_64/7/x86_64/7/epel/repodata/e8...19-updateinfo.xml.bz2.

and running dnf clean all doesn’t solve this.

There seems to be bug report about this, without a solution.

Is there some way to get dnf working on CentOS 7?

Asked By: user148019


I am not sure why this is, but it looks like the epel-release repository (from where you install dnf) is not compatible with dnf itself. After installing dnf, first remove this using yum:

yum remove epel-release

and after that:

dnf repolist
dnf list installed

etc. worked (at least on my CentOS 7 system).

Answered By: Anthon

The issue may have to do with the installed version of libsolv not supporting bzip2 compression. Like me, you may not have the most recent version being installed because setting priorities in the repo config files.

Failed to open: /var/cache/dnf/x86_64/7/x86_64/7/epel/…xml.bz2

See bug report 1258416.

libsolv-0.6.14-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If
problems still persist, please make note of it in this bug report.

The libsolv installed from the CentOS base repository is 0.6.11-1.el7, but the one in epel is 0.6.14-1.el7.

yum --showduplicates --disablerepo=base list libsolv
Installed Packages
libsolv.x86_64          0.6.11-1.el7          @base
Available Packages
libsolv.x86_64          0.6.14-1.el7          epel


Install libsolv from the epel repository.

yum --disablerepo=base install libsolv-0.6.14-1.el7

Edit: 2016-06-17

As seen in the comments, this is still an active bug with the package repositories. This is because of libsolv being marked as “retired” in the EPEL without an explanation (Theodor van Nahl). Dennis M. Pöpperl points out that RPMs of versions that had seemed to have been working in CentOS and RHEL are available here in the Fedora build system.

Answered By: Kevin
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.