Yum Doesn’t Work In Clean CentOS 7 – How To Fix It?

Yum doesn't work in clean CentOS 7

Today, I was banging my head on the wall to find the solution for the following mysterious problem. Whenever I run any command in the Terminal, be it a installing a package or updating the system, my CentOS 7 minimal system  has thrown the following error.

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * elrepo: ftp.nluug.nl
 * extras: mirrors.vonline.vn
 * updates: mirrors.vonline.vn
Traceback (most recent call last): 27% [================ ] 140 kB/s | 2.5 MB 00:00:48 ETA 
 File "/usr/libexec/urlgrabber-ext-down", line 75, in 
 File "/usr/libexec/urlgrabber-ext-down", line 61, in main
 fo = PyCurlFileObject(opts.url, opts.filename, opts)
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1258, in __init__
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1589, in _do_open
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1723, in _do_grab
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1517, in _do_perform
 raise KeyboardInterrupt

Exiting on user cancel

I neither cancel the process nor interrupt the keyboard, but my CentOS 7 virtual machine kept displaying the above error. I tried many times, yet I couldn’t install any packages or update the system.

Thankfully, I found a solution from this thread.

Here it is what I did to solve the problem. Just in case, you are running through the same error, do the following.

From your Terminal, run the following commands one by one as root user:

yum clean metadata
yum clean all
yum upgrade

Or, simply run the one line command as root user:

bash -c 'yum clean metadata && yum upgrade'

That’s it. Problem is gone! Now, I could install any software without any issues.

Update on April 12, 2016:

Unfortunately, the above solution didn’t work for me anymore. I have no idea why. However, I managed to temporarily fix the above error by doing the following trick.

Edit /usr/lib/python2.7/site-packages/urlgrabber/grabber.py file,

vi /usr/lib/python2.7/site-packages/urlgrabber/grabber.py

Find the following line (1510th line), and commend it by adding a hash symbol (#) in-front of it.

# elif errcode in (42, 55, 56):

Save and close the file.

And finally, run the following commands one by one as root user:

yum clean metadata
yum clean all
yum upgrade

This time it worked! I really have no idea why is this happening. Hope this helps. I will be soon here with another useful guide. Until then, stay tuned with OSTechNix!


Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...