1. 程式人生 > >解決yum不能正常使用的問題

解決yum不能正常使用的問題

gcc module str 成功 error except exc lrzsz oot

解決yum不能正常使用的問題

問題1

Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  19 M RSS (303 MB VSZ)
    Started: Wed Mar 21 11:11:28 2018 - 02:52 ago
    State  : Traced/Stopped, pid: 6373
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  19 M RSS (303 MB VSZ)
    Started: Wed Mar 21 11:11:28 2018 - 02:54 ago
    State  : Traced/Stopped, pid: 6373

解決方法:
1、這是yum被鎖了,是因為之前執行了一遍未把進程完整的停掉
ps aux | grep yum |grep -v grep |awk ‘{print $2}’ | xargs kill -9
? 2、直接刪掉yum的pid文件,pid文件是用來管理服務的啟動,關閉。
rm -rf /var/run/yum.pid


問題2

# yum install lrzsz -y  
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
   /usr/lib64/python2.6/site-packages/pycurl.so: undefined symbol: CRYPTO_set_locking_callback
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.6.6 (r266:84292, Nov 22 2013, 12:16:22) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

解決:
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
再安裝,需要加上sudo
sudo yum install lrzsz -y


問題3、
1、使用yum安裝測試

# yum install iotop  
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.13 (default, Nov 13 2017, 14:44:54) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)]
If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

備註:沒有模塊yum

2、查看yum使用的語言

# which yum `
/usr/bin/yum
[root@hm_wwwyufabu_216_37 ~]# cat /usr/bin/yum 
#!/usr/bin/python  (使用的是Python的默認版本)
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
```:
.................................

備註:
Python編寫的,調用yum模塊失敗

3、查看Python版本

# python
python     python2    python2.4  python2.7 
# python   (Python默認版本調用失敗)
Python 2.7.13 (default, Nov 13 2017, 14:44:54) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named yum
>>> 
[1]+  Stopped                 python
# python2 (python2版本調用失敗)
Python 2.7.13 (default, Nov 13 2017, 14:44:54) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named yum
>>> 
[2]+  Stopped                 python2
# python2.4 (Python2.4版本調用成功)
Python 2.4.3 (#1, Jan 21 2009, 01:10:13) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>> 

4、修改yum文件中的Python版本

# cat /usr/bin/yum 
#!/usr/bin/python2.4
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:

解決yum不能正常使用的問題