yum 崩溃的解决方法

作者: print("") 分类: linux 发布时间: 2018-06-05 16:40

唔、一个用户宝塔登陆界面一直是打转转,

看日志把日志显示

119.147.144.162:49468 - - [05/Jun/2018 16:10:23] "HTTP/1.1 GET /favicon.ico" - 500 Internal Server Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/web/application.py", line 237, in process
    return p(lambda: process(processors))
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 85, in _processor
    self._load()
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 106, in _load
    d = self.store[self.session_id]
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 303, in __getitem__
    return self.decode(s.data)
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 209, in decode
    pickled = base64.decodestring(session_data)
  File "/usr/local/lib/python2.7/base64.py", line 328, in decodestring
    return binascii.a2b_base64(s)
Error: Incorrect padding

119.147.144.162:49468 - - [05/Jun/2018 16:10:23] "HTTP/1.1 GET /login" - 500 Internal Server Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/web/application.py", line 237, in process
    return p(lambda: process(processors))
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 85, in _processor
    self._load()
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 106, in _load
    d = self.store[self.session_id]
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 303, in __getitem__
    return self.decode(s.data)
  File "/usr/local/lib/python2.7/site-packages/web/session.py", line 209, in decode
    pickled = base64.decodestring(session_data)
  File "/usr/local/lib/python2.7/base64.py", line 328, in decodestring
    return binascii.a2b_base64(s)
Error: Incorrect padding

唔。找了很久。最后发现竟然是yum 有问题。emmmmm 报错如下:

[root@iZdt4mpwkybe8hZ tmp]# yum install wget  There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.15 (default, Jun  5 2018, 13:52:24) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

看着网上哪些人说,修改一下/use/bin/yum

修改了第一行为

[root@iZdt4mpwkybe8hZ tmp]# vi /usr/bin/yum 

#!/usr/bin/python2
import sys
try:
    import yum
except ImportError:
    print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   %s

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
%s

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

""" % (sys.exc_value, sys.version)
    sys.exit(1)

sys.path.insert(0, '/usr/share/yum-cli')
try:
    import yummain
    yummain.user_main(sys.argv[1:], exit_code=True)
except KeyboardInterrupt, e:
    print >> sys.stderr, "\n\nExiting on user cancel."
    sys.exit(1)

emmm 结果很尴尬的

[root@iZdt4mpwkybe8hZ tmp]# yum  install wget 
Loaded plugins: fastestmirror
base                                                                                                      | 3.6 kB  00:00:00     
epel                                                                                                      | 3.2 kB  00:00:00     
extras                                                                                                    | 3.4 kB  00:00:00     
updates                                                                                                   | 3.4 kB  00:00:00     
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
ImportError: No module named urlgrabber.grabber
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
ImportError: No module named urlgrabber.grabber
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
ImportError: No module named urlgrabber.grabber
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
ImportError: No module named urlgrabber.grabber

唔看了一下报错。发现没有这个模块,那么pip 安装一个把

[root@iZdt4mpwkybe8hZ yum.repos.d]# pip install urlgrabber
Looking in indexes: https://pypi.doubanio.com/simple/
Collecting urlgrabber
  Downloading https://pypi.doubanio.com/packages/29/1a/f509987826e17369c52a80a07b257cc0de3d7864a303175f2634c8bcb3e3/urlgrabber-3.10.2.tar.gz (84kB)
    100% |████████████████████████████████| 92kB 5.7MB/s 
Building wheels for collected packages: urlgrabber
  Running setup.py bdist_wheel for urlgrabber ... done
  Stored in directory: /root/.cache/pip/wheels/fc/d8/3b/06e617fb35ebe30fc48412a2963a17e9b88e2d21f9f40c8e01
Successfully built urlgrabber
Installing collected packages: urlgrabber
Successfully installed urlgrabber-3.10.2

唔安装成功,那么再用一下yum 把

[root@iZdt4mpwkybe8hZ yum.repos.d]# yum  install python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
  File "/usr/local/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
    from grabber import urlgrab, urlopen, urlread
  File "/usr/local/lib/python2.7/site-packages/urlgrabber/grabber.py", line 532, in <module>
    Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    import pycurl
ImportErrorfrom urlgrabber.grabber import \
  File "/usr/local/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
: No module named pycurl    
from grabber import urlgrab, urlopen, urlread
  File "/usr/local/lib/python2.7/site-packages/urlgrabber/grabber.py", line 532, in <module>
    import pycurl
ImportError: No module named pycurl
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
  File "/usr/local/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
    from grabber import urlgrab, urlopen, urlread
  File "/usr/local/lib/python2.7/site-packages/urlgrabber/grabber.py", line 532, in <module>
    import pycurl
ImportError: No module named pycurl

唔还是报错。安装一下pycurl 把

[root@iZdt4mpwkybe8hZ yum.repos.d]# pip install pycurl
Looking in indexes: https://pypi.doubanio.com/simple/
Collecting pycurl
  Downloading https://pypi.doubanio.com/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz (214kB)
    100% |████████████████████████████████| 215kB 11.5MB/s 
    Complete output from command python setup.py egg_info:
    Using curl-config (libcurl 7.29.0)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-xDCpxU/pycurl/setup.py", line 913, in <module>
        ext = get_extension(sys.argv, split_extension_source=split_extension_source)
      File "/tmp/pip-install-xDCpxU/pycurl/setup.py", line 582, in get_extension
        ext_config = ExtensionConfiguration(argv)
      File "/tmp/pip-install-xDCpxU/pycurl/setup.py", line 99, in __init__
        self.configure()
      File "/tmp/pip-install-xDCpxU/pycurl/setup.py", line 316, in configure_unix
        specify the SSL backend manually.''')
    __main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-xDCpxU/pycurl/

emmm 竟然报错.  tmd  那么就编译一个把

下载pycurl:http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz
tar xzf pycurl-7.19.0.tar.gz
python setup.py install

然后测试一下

[root@iZdt4mpwkybe8hZ tmp]# python 
Python 2.7.15 (default, Jun  5 2018, 13:52:24) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycurl
>>> 

如果出现问题。那么就这样编译

提示如下错误:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named pycurl

检查一下,原来是pycurl自己假定的curl路径不对。
需要给pycurl指定curl-config 路径,如下所示:
python setup.py install --curl-config=/usr/local/bin/curl-config
问题很小,有点隐蔽
[root@iZdt4mpwkybe8hZ pycurl-7.19.0]# yum install wget 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
(1/3): extras/7/x86_64/primary_db                                                                         | 147 kB  00:00:00     
(2/3): updates/7/x86_64/primary_db                                                                        | 2.0 MB  00:00:00     
(3/3): base/7/x86_64/primary_db                                                                           | 5.9 MB  00:00:00     
epel/x86_64/primary                                                                                       | 3.5 MB  00:00:00     
epel                                                                                                                 12585/12585
Package wget-1.14-15.el7_4.1.x86_64 already installed and latest version
Nothing to do

唔搞定了!!!!!

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

您的电子邮箱地址不会被公开。