Sunday, 7 June 2015

Fedora 22 - Unresponsive Mirrors and DNF

After installing a fresh copy of Fedora 22, I discovered that I could not install any packages due to a faulty mirror. DNF, the new package manager, failed to detect the faulty mirror and move on to the next available one. Here are a few tweaks I made to get DNF to work even in the face of bad mirrors.

Manually install the latest update to librepo 

At the time of writing, a bug fix to detect unresponsive mirrors is available in the updates-testing repo. Usually this can be installed using a command like sudo dnf --enable-repo fedora-updates-testing install librepo. However, due to the broken mirror, it will not succeed. Manually download librepo-1.7.16-1.fc22.$ARCH.rpm, python-librepo-1.7.16-1.fc22.$ARCH.rpm and python3-librepo-1.7.16-1.fc22.$ARCH.rpm from and install it as follows: 

sudo rpm -Uvh librepo-1.7.16-1.fc22.x86_64.rpm python-librepo-1.7.16-1.fc22.x86_64.rpm python3-librepo-1.7.16-1.fc22.x86_64.rpm

Enable fastest mirror 

Edit /etc/dnf/dnf.conf and add the line fastestmirror=True. For reference, my complete dnf.conf looks as follows:


Disable repo failovermethod (Optional)

If you are having problems with a particular repo, edit the corresponding file in /etc/yum.repos.d/ and comment out the line that reads: failovermethod=priority. This instructs DNF to try any mirror instead of the first one in the list received from the metadata server.