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

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

By sk
Published: Updated: 2.5K views

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 is throwing 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
Exiting on user cancel centos 7

Exiting on user cancel centos 7

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.

You May Also Like

2 comments

Ragesh Moorkoth March 4, 2020 - 3:45 pm

yum upgrading error
sudo vi /usr/libexec/urlgrabber*

change
#! /usr/bin/python to #! /usr/bin/python2

Above worked for me

Reply
sk March 4, 2020 - 4:06 pm

Thanks for the update. Much appreciated.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More