// message : Failed to set locale, defaulting to C

[root@localhost network-scripts]# yum update

Failed to set locale, defaulting to C

??????fastestmirror, langpacks

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Loading mirror speeds from cached hostfile

No packages marked for update

[root@localhost network-scripts]#

// locale

[root@localhost network-scripts]# locale

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: ?????????

LANG=zh_CN.UTF-8

LC_CTYPE=UTF-8

LC_NUMERIC="zh_CN.UTF-8"

LC_TIME="zh_CN.UTF-8"

LC_COLLATE="zh_CN.UTF-8"

LC_MONETARY="zh_CN.UTF-8"

LC_MESSAGES="zh_CN.UTF-8"

LC_PAPER="zh_CN.UTF-8"

LC_NAME="zh_CN.UTF-8"

LC_ADDRESS="zh_CN.UTF-8"

LC_TELEPHONE="zh_CN.UTF-8"

LC_MEASUREMENT="zh_CN.UTF-8"

LC_IDENTIFICATION="zh_CN.UTF-8"

LC_ALL=

[root@localhost network-scripts]# 

// root cause

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: ?????????

// solution

[root@localhost profile.d]# vi /etc/profile.d/locale.sh 

export LC_CTYPE="zh_CN.UTF-8"

export LC_ALL="zh_CN.UTF-8"

[root@localhost profile.d]# source /etc/profile.d/locale.sh

~                                                                               

~                          

// verify 1

[root@localhost profile.d]# locale

LANG=zh_CN.UTF-8

LC_CTYPE="zh_CN.UTF-8"

LC_NUMERIC="zh_CN.UTF-8"

LC_TIME="zh_CN.UTF-8"

LC_COLLATE="zh_CN.UTF-8"

LC_MONETARY="zh_CN.UTF-8"

LC_MESSAGES="zh_CN.UTF-8"

LC_PAPER="zh_CN.UTF-8"

LC_NAME="zh_CN.UTF-8"

LC_ADDRESS="zh_CN.UTF-8"

LC_TELEPHONE="zh_CN.UTF-8"

LC_MEASUREMENT="zh_CN.UTF-8"

LC_IDENTIFICATION="zh_CN.UTF-8"

LC_ALL=zh_CN.UTF-8

[root@localhost profile.d]# 

// verify 2

[root@localhost profile.d]# yum update

已加载插件:fastestmirror, langpacks

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Loading mirror speeds from cached hostfile

No packages marked for update

[root@localhost profile.d]#