bug宝典linux篇 LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory(转)

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

 1 Connecting to 192.168.1.76:22...
 2 Connection established.
 3 To escape to local shell, press Ctrl+Alt+].
 4 
 5 WARNING! The remote SSH server rejected X11 forwarding request.
 6 Last login: Mon Mar 18 07:34:16 2019 from 192.168.1.216
 7 -bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
 8 -bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
 9 -bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
10 -bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
11 -bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory

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

1 [root@localhost ~]# more /etc/sysconfig/i18n
2 LANG="en_US.UTF-8"
3 SYSFONT="latarcyrheb-sun16"

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

 1 [root@dashuju172 ~]# locale
 2 locale: Cannot set LC_CTYPE to default locale: No such file or directory
 3 locale: Cannot set LC_MESSAGES to default locale: No such file or directory
 4 locale: Cannot set LC_ALL to default locale: No such file or directory
 5 LANG=en_US.UTF-8
 6 LC_CTYPE="en_US.UTF-8"
 7 LC_NUMERIC="en_US.UTF-8"
 8 LC_TIME="en_US.UTF-8"
 9 LC_COLLATE="en_US.UTF-8"
10 LC_MONETARY="en_US.UTF-8"
11 LC_MESSAGES="en_US.UTF-8"
12 LC_PAPER="en_US.UTF-8"
13 LC_NAME="en_US.UTF-8"
14 LC_ADDRESS="en_US.UTF-8"
15 LC_TELEPHONE="en_US.UTF-8"
16 LC_MEASUREMENT="en_US.UTF-8"
17 LC_IDENTIFICATION="en_US.UTF-8"
18 LC_ALL=

解决方案,修改如下:

1 vim /etc/sysconfig/i18n
2 // 添加下面的
3 LC_ALL=C
4 export LC_ALL
5 // 再执行下面的语句,使之生效
6 source /etc/sysconfig/i18n

LC_ALL=C的含义


原文:https://blog.csdn.net/warrah/article/details/56008990

 

posted @ 2019-03-18 15:51  insistYuan  阅读(3816)  评论(0编辑  收藏  举报