Error using YUM and DNF in Fedora 21

Abhinav Kulshreshtha picture Abhinav Kulshreshtha · Jan 29, 2015 · Viewed 7.2k times · Source

I read this article in fedoramagzine.org and followed the process. Since then I am unable to perform updates, installation etc from both yum and dnf.

This is the error I get from DNF

Abhinav@localhost ~$ sudo dnf update
[sudo] password for Abhinav:
Error: Failed to synchronize cache for repo 'fedora' from 'https://mirrors.fedoraproject.org/metalink?repo=fedora-21&arch=x86_64': Cannot prepare internal mirrorlist: Curl error: Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=fedora-21&arch=x86_64 [Connection timed out after 120002 milliseconds]

and this is the error I get when using YUM

Abhinav@localhost ~$ sudo yum update Loaded plugins: langpacks
One of the configured repositories failed (Fedora 21 - x86_64), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Disable the repository, so yum won't use it by default. Yum will then
    just ignore the repository until you permanently enable it again or use
    --enablerepo for temporary usage:

        yum-config-manager --disable fedora

 4. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=fedora.skip_if_unavailable=true

Cannot retrieve metalink for repository: fedora/21/x86_64. Please verify its path and try again

I even emptied all the repos in /etc/yum.repos.d except for the original 3 repos you get when you install distro.

UPDATE ::
@Etan Reisner Here is the output of rpm -qa nss\*

 Abhinav@localhost ~$ rpm -qa nss\*
 nss-softokn-freebl-3.17.3-1.fc21.x86_64
 nss-util-devel-3.17.3-1.fc21.x86_64 nss-sysinit-3.17.3-2.fc21.x86_64
 nss-util-3.17.3-1.fc21.x86_64 nss-tools-3.17.3-2.fc21.x86_64
 nss-softokn-freebl-3.17.3-1.fc21.i686 nss-3.17.3-2.fc21.x86_64
 nss-softokn-freebl-devel-3.17.3-1.fc21.x86_64
 nss-mdns-0.10-15.fc21.x86_64 nss-mdns-0.10-15.fc21.i686
 nss-util-3.17.3-1.fc21.i686 nss-softokn-3.17.3-1.fc21.i686
 nss-devel-3.17.3-2.fc21.x86_64 nss-softokn-devel-3.17.3-1.fc21.x86_64
 nss-3.17.3-2.fc21.i686 nss-softokn-3.17.3-1.fc21.x86_64

UPDATE 2

Formatted my laptop and re-installed Fedora 21. After 3 sudo dnf updates. I am stuck with this problem again. This time i didn't follow the steps on the previous article.

On further google search I found https://fedorahosted.org/fedora-infrastructure/ticket/4517 which talks about same error. It is closed but I can't find a proper solution again.

Answer

huck picture huck · Sep 29, 2015

If you sit behind a proxy, you have to configure dnf accordingly. (Even if the user's proxy settings are fine, you have to set them for dnf anyway.) The dnf settings are stored in /etc/dnf/dnf.conf. The syntax is:
proxy=<protocol>://<ip or name>:<port>

If this is not your problem, try to download the metadata with the browser to ensure, that your network connection to the url is working.
The file to receive should be an xml file. If you cannot download the metadata via the browser, chances are, that either port 443 (for https) is blocked or there is something wrong with your internet connection.