0

I tried to update my CentOS on my server using yum update but I get the following error:

Traceback (most recent call last):
  File "/usr/bin/yum", line 4, in <module>
    import yum
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 59, in <module>
    import config
  File "/usr/lib/python2.7/site-packages/yum/config.py", line 30, in <module>
    from parser import ConfigPreProcessor, varReplace
  File "/usr/lib/python2.7/site-packages/yum/parser.py", line 4, in <module>
    import urlgrabber
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
    from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1616
    errstr = str(e.args[1]) or pyerr2str.get(errcode, '<Unknown>')

I can only guess that my python has some serious problems. How can I fix that?

P.S. I'm experienced in debian based systems but not in rpm based. This is my first rpm based server so please be tolerant.

Edit:

[root@WEBITCONSULT ~]# yum repolist
Traceback (most recent call last):
  File "/usr/bin/yum", line 4, in <module>
    import yum
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 59, in <module>
    import config
  File "/usr/lib/python2.7/site-packages/yum/config.py", line 30, in <module>
    from parser import ConfigPreProcessor, varReplace
  File "/usr/lib/python2.7/site-packages/yum/parser.py", line 4, in <module>
    import urlgrabber
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
    from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1616
    errstr = str(e.args[1]) or pyerr2str.get(errcode, '<Unknown>')
         ^
SyntaxError: invalid syntax

1 Answers1

0

Try following to clean yum cache and metadata.

yum clean metadata && yum clean all

Rebuild RPM database.

rm -f /var/lib/rpm/__db*
rpm -vv --rebuilddb

If you still have issues include output of yum repolist here

Deeh
  • 581
  • 3
  • 9
  • Thx, unfortunately it didnt worked :/ I included that error log in my question – digitalosaurus Jan 22 '20 at 21:23
  • Any errors in `/var/log/messages`? – Deeh Jan 22 '20 at 21:43
  • Try reinstalling python...steps for Centos7 64bit `wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-2.7.5-86.el7.x86_64.rpm && rpm -ivh --replacepkgs python-2.7.5-86.el7.x86_64.rpm && rm -f python-2.7.5-86.el7.x86_64.rpm` – Deeh Jan 22 '20 at 21:52
  • Thanks again. Got following error :/. `error: Failed dependencies: python-libs(x86-64) = 2.7.5-86.el7 is needed by python-2.7.5-86.el7.x86_64 ` – digitalosaurus Jan 22 '20 at 22:03
  • replace URL in my previous comment with `http://mirror.centos.org/centos/7/os/x86_64/Packages/python-libs-2.7.5-86.el7.x86_64.rpm`. You can find this and other RPMs [here](http://mirror.centos.org/centos/7/os/x86_64/Packages/) – Deeh Jan 23 '20 at 02:55