10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

yum が "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)" エラーを投げる

Last updated at Posted at 2015-07-14

環境情報

RedHat Enterprise Linux 7.1

事象

bash
[root@aaaa yum.repos.d]# yum search zsh
読み込んだプラグイン:langpacks, product-id, subscription-manager
'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
============================================ N/S matched: zsh ============================================
zsh-html.x86_64 : Zsh shell manual in html format
zsh.x86_64 : Powerful interactive shell

  Name and summary matches only, use "search all" for everything.

なんか出てきた

bash
'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128) 

公式サイトの対応法

原因

  • yumdb が破損している可能性がある
  • 言語環境がUTF-8になっていない

対策

1やってだめなら、2をやりましょう

1. yumdbを消す

bash
mv /var/lib/yum/yumdb/ /tmp
yumdb sync

2. pythonデフォルトエンコーディングの変更

どうやらyumはpythonスクリプトのようです。

vi /usr/lib/python2.7/site-packages/sitecustomize.py

import sys
sys.setdefaultencoding("utf-8")

結論

CentOSではならなかったので、RedHatが悪い。

10
9
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
10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?