40

I am running yum check-update and it freezes after a 2 lines of output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

I'm not sure what is happening. The last things I remember doing with yum were yum update and looking at one of the CentOS yum repos but I didn't make any changes.

Any suggestions to fix yum?

0

6 Answers 6

23

You may have a DNS issue. Try to ensure you can resolve DNS records locally:

nslookup google.com

If you get an IP back from that command, you should be OK for DNS. Try then removing the fastestmirror cache and re-running your yum command:

rm -f /var/cache/yum/timedhosts.txt

2
  • 1
    I did get an IP back from that command. timedhosts.txt was an empty text file but I tried removing it anyways. I then reran my yum command. Unfortunately no success. It's still hanging at the same place, "Determining fastest mirrors". If I run verbose, I get Loading "fastestmirror" plugin Config time: 0.094 Yum Version: 3.2.22 Setting up Package Sacks Loading mirror speeds from cached hostfile
    – barrrista
    Feb 1, 2012 at 23:58
  • 11
    To rule out an issue with the fastestmirror plugin, try running yum without any plugins: yum --noplugins check-update
    – Garrett
    Feb 2, 2012 at 0:23
86

All of this did not work with me.

Using CentOS and yum. yum hangs without an error message, at least, so it appears. Pressing Ctrl+C does not work (pressing it again and again and again does).

Several things need to be checked: - are the repositories OK? - is networking OK? - are the yum and rpm databases OK?

So, first start with the easy stuff - clean the databases:

rm -f /var/lib/rpm/__*
rpm --rebuilddb -v -v   
yum clean all

If that did not work, you can set a debug level, error level and timeout for yum in /etc/yum.conf:

debuglevel=1
errorlevel=1
timeout=1

The timeout is standard 30 seconds. So if a repository does not respond, the error takes 30 seconds to appear. Also try using yum without the plugins (like fastest mirror and priorities) with the option --noplugins. Now starting yum again should give you more info faster. Test with:

yum --verbose --noplugins info

You might get something like this:

 Config time: 0.105
 Yum Version: 3.2.22
 Setting up Package Sacks
 Loading mirror speeds from cached hostfile
 * base: mirror.nl.leaseweb.net
 * extras: mirror.nl.leaseweb.net
 * ius: mirrors.ircam.fr
 * rpmforge: mirror.nl.leaseweb.net
 * updates: mirror.nl.leaseweb.net link-to-server-repository/repomd.xml: [Errno 4] IOError: urlopen error (97, 'Address family not supported by protocol') 
 Trying other mirror.

This indicates no information can be received from the server. Try the URL that is displayed by yum (indicated above with link-to-server-repository) in your web browser. Copy&paste it from your yum response, not from this post! If you get a list, you know the repository is online.

If you get an error in your browser, try removing that repository from /etc/yum.repos.d. Try to fetch the list on your server with wget and paste the URL:

wget link-to-server-repository/repomd.xml

If this generates a timeout, then there's a problem with your firewall or proxy settings. Try to disable your firewall.

If you are running csf (ConfigServer Security and Firewall) and lfd you can disable csf with:

csf -x

Try yum again and if it works, you'll have to reconfigure your csf. Enable csf again with:

csf -e

And also check your proxy settings. You can also try to change the https in to http in the .repo files at /etc/yum.repos.d/.

6
  • 1
    This answer is worth so much more than 4 upvotes =(
    – mveroone
    Dec 11, 2013 at 13:11
  • 1
    Lots of good information here. Increasing the debugging level and running yum --verbose --noplugins info led me to find "Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again" which I am investigating now. My DNS is working so that should not be the problem. Jun 16, 2014 at 16:39
  • 3
    An important point that seems to be missing in this answer is that yum check can take hours to complete! More info: centos.org/forums/viewtopic.php?f=14&t=46676
    – gmas80
    Dec 16, 2014 at 18:30
  • Database cleanup worked for me too Jul 4, 2016 at 11:35
  • 1
    I had the same issue (yum hanging with no no error message). The solution was to execute strace yum info, which showed that yum had a wait on file /var/lib/rpm/.dbenv.lock. After removing this file, yum worked again as expected.
    – botkop
    Jul 20, 2017 at 5:53
5

In my case it was a lingering RPM database lock file /var/lib/rpm/.dbenv.lock that made yum commands hang. After removing that file yum could be used again.

2

I had a similar issue. It turned out to be an old DNS address in resolv.conf. I changed the IP to the correct one, and it fixed the issue.

1
  • Under Vagrant this can happen too. Feb 25, 2015 at 12:22
1

Had a similar issue and the reason was the presence of yum lock file /var/run/yum.pid where a previous yum run left it because of a fatal error.

I removed it with sudo rm /var/run/yum.pid and problem was solved.

0

Sorry, don't have enough reputation to ask about this comment above:

Trying this solution, I noticed that everything would run fine when using --noplugins. After a binary search amongst the plugins, I found that subscription-manager was the one causing all the trouble. I disabled it and voilà! – Mariuslp

@mariuslp, I also can only run yum by adding --noplugins. Can you provide more detail as to how you did a "binary search amongst the plugins" and what in that search led you determine what was causing the trouble? Thanks!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .