LoginSignup
5
7

More than 5 years have passed since last update.

yumが壊れたときの対処法

Posted at

どんなことがあったのか

CentOS(今回は6.9)の環境で、yumなんて普通によく使うけど、いきなり使えなくなった。
根本はpythonのバージョンのせいかな?
→もはやよくわからない。

参考のサイトにいろいろ行ったり来たりして、最終的には動くようにはなった。

File "/usr/bin/yum", line 29, in ~

最初のエラー
次のようなエラーが発生し、なんもできねー

# yum update

読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 370, in user_main
    errcode = main(args)
  ...

対処

yumのコンフィグファイルを修正

/etc/yum/pluginconf.d/fastestmirror.conf
[main]
enabled=0

参考

No module named yum

第2のエラー
バージョンが合わないとかいうー

↓は似たようなログ(実際に発生したときとは異なる)

# yum update
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.5 (r265:79063, Feb 28 2011, 21:55:45) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

対処

yumを実行するpythonの指定

/usr/bin/yum修正前
#!/usr/bin/python
import sys
try:
    import yum
    ...
/usr/bin/yum修正後
#!/usr/bin/python2.6
import sys
try:
    import yum
    ...

参考

5
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7