Yum don’t work in clean CentOS 7 – How to fix it?

Today, I have been 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 threw 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 
 main()
 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__
 self._do_open()
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1589, in _do_open
 self._do_grab()
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1723, in _do_grab
 self._do_perform()
 File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1517, in _do_perform
 raise KeyboardInterrupt
KeyboardInterrupt

Exiting on user cancel

CentOS 7 -1 [Running] - Oracle VM VirtualBox_001

I neither cancel the process nor interrupt the keyboard, but my CentOS 7 virtual machine was continuously giving the above error. I tried so many times, but 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.

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, sometimes, the above solution didn’t work for me. In order to temporarily fix the above error, I did the following.

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. Hopefully this helps out a few people that have been facing the same issue.

Cheers!

You may also like...