Solve problems related to "UnicodeDecodeError: 'ascii 'codec" in yum
Problem
The CentOS6.5 system is newly installed, and the following error occurs when you plan to use the yum Installer:
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 285, in user_main
Errcode = main (args)
File "/usr/share/yum-cli/yummain. py", line 136, in main
Result, resultmsgs = base. doCommands ()
File "/usr/share/yum-cli/cli. py", line 434, in doCommands
Self. _ getTs (needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve. py", line 99, in _ getTs
Self. _ getTsInfo (remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve. py", line 110, in _ getTsInfo
PkgSack = self. pkgSack
File "/usr/lib/python2.6/site-packages/yum/_ init _. py", line 887, in <lambda>
PkgSack = property (fget = lambda self: self. _ getSacks (),
File "/usr/lib/python2.6/site-packages/yum/_ init _. py", line 669, in _ getSacks
Self. repos. populateSack (which = repos)
File "/usr/lib/python2.6/site-packages/yum/repos. py", line 279, in populateSack
Self. doSetup ()
File "/usr/lib/python2.6/site-packages/yum/repos. py", line 105, in doSetup
Self. ayum. plugins. run ('postreposetup ')
File "/usr/lib/python2.6/site-packages/yum/plugins. py", line 184, in run
Func (conduitcls (self, self. base, conf, ** kwargs ))
File "/usr/lib/yum-plugins/fastestmirror. py", line 197, in postreposetup_hook
If downgrade_ftp and _ len_non_ftp (repo. urls) = 1:
File "/usr/lib/python2.6/site-packages/yum/yumRepo. py", line 699, in <lambda>
Urls = property (fget = lambda self: self. _ geturls (),
File "/usr/lib/python2.6/site-packages/yum/yumRepo. py", line 696, in _ geturls
Self. _ baseurlSetup ()
File "/usr/lib/python2.6/site-packages/yum/yumRepo. py", line 648, in _ baseurlSetup
Self. Required URLs = self. _ replace_and_check_url (required URLs)
File "/usr/lib/python2.6/site-packages/yum/yumRepo. py", line 691, in _ replace_and_check_url
Print 'yum repo Error: All mirror URLs are not using ftp, http [s] or file. \ n Eg. % s' % misc. to_utf8 (skipped)
File "/usr/lib64/python2.6/codecs. py", line 351, in write
Data, consumed = self. encode (object, self. errors)
UnicodeDecodeError: 'ascii 'codec can't decode byte 0xbc in position 3746: ordinal not in range (128)
Solution
Perform the following operations in sequence:
Cd/var/lib/rpm/
Rm-I _ db .*
Yum clean all
Yum history new