SSH登录linux系统,提示cannot change locale (en_US.UTF-8): No such file or directory的处理方法

2018年10月19日09:38:37 发表评论

升级glibc库后,使用SecureCRT登录linux,提示:

Last login: Mon Feb 20 02:03:21 2017 from 192.168.4.187
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory

执行more /etc/sysconfig/i18n命令检查系统字符集

[root@dashuju172 ~]# more /etc/sysconfig/i18n 
LANG="en_US.UTF-8"
SUPPORTED="zh_CN.GB18030:zh_CN:zh:zh_CN.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"

执行locale命令,提示如下异常,说明说明没安装en_US的local

[root@dashuju172 ~]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

解决方案,修改如下:

vi /etc/sysconfig/i18n
# 添加下面的
LC_ALL=C
export LC_ALL
# 再执行下面的语句,使之生效
source /etc/sysconfig/i18n
weinxin
我的微信:18682260315
分享网络营销技巧与广大的网络营销爱好者交流网络营销方案、技巧、策划、案例、SEO、网络推广、社会化媒体营销等网络营销知识。
avatar

发表评论

您必须才能发表评论!