问题症状

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

解决方法

本地化是指不同地区用户在键盘上输入不同语言的字符集。例如 en_US 表示美国英语字符集,因此只有正确设置了服务器的字符集,服务器才能理解用户的输入字符。setlocale 命令可以帮助用户来设置本地化字符集。

出现以上问题是因为服务器无法理解 en_US.UTF-8 字符集,因此首先要在服务器上生成 en_US.UTF-8 字符集:

sudo locale-gen en_US.UTF-8

然后使用最新生成的字符集更新本地仓库:

sudo dpkg-reconfigure locales

最后更新 /etc/default/locale 文件,例如更新前的文件内容为:

LANG=C.UTF-8

更新后:

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8

环境变量 LC_ALL 会覆写所有的本地化设置(在某些情况下 $LANGUAGE 不会被覆写),例如 LC_NAME, LC_ADDRESS 等等。设置 LC_ALL=en_US.UTF-8 表示所有的本地化设置都使用 en_US.UTF-8。

重新登录服务器,warning 警告不再出现,问题解决。

Ref:

bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

[Ubuntu] bash: warning: setlocale: LC_ALL: cannot change locale的更多相关文章

  1. bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

    bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) Q: hubery@roaster:~$ locale loc ...

  2. 【云计算】Docker 镜像如何设置语言环境?bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

    解决方案: # set default language environment RUN locale-gen en_US.UTF- \ && dpkg-reconfigure loc ...

  3. 关于 /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en.US_UTF-8) 问题

    亲测可行 中文 # vim /etc/profile.d/locale.sh export LC_CTYPE=zh_CN.UTF-8 export LC_ALL=zh_CN.UTF-8 # vim / ...

  4. /bin/sh: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8) centos7

    今天登陆centos 7 遇到一个 警告 /bin/sh: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8) bash : ...

  5. -bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_US.UTF-8): No such file or directory -bash: warning: setlocale: LC_COLLATE:

    前几天登录服务器发现出现了这些个警告,一直没时间去处理他,今天难得有空,处理一下并记录下来,希望可以帮助到有需要的朋友. 警告信息如下: Last :: from 10.0.0.1 -bash: wa ...

  6. -bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8mb4): No such file or directory

    前几天登录服务器发现出现了这些个警告,一直没时间去处理他,今天难得有空,处理一下并记录下来,希望可以帮助到有需要的朋友. 警告信息如下: Last login: Tue May :: from 192 ...

  7. MacOs -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

    1解决iterm远程登录主机报错 -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or ...

  8. -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

    本人使用mac系统,命令行工具使用的iterm2,登录自己的云主机的时候 每次都要提示如下错误 -bash: warning: setlocale: LC_CTYPE: cannot change l ...

  9. docker本地化异常:/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

    docker中经常设置不了 环境变量$LC_ALL,  导致报很多奇怪的编码错误: /bin/sh: warning: setlocale: LC_ALL: cannot change locale ...

随机推荐

  1. python web框架——初识tornado

    一 Tornado概述 Tornado是FriendFeed使用的可扩展的非阻塞式web框架及其相关工具的开源版本.这个Web框架看起来有些像web.py或者Google的 webapp,不过为了能有 ...

  2. 解决12306.cn网站验证码获取提示“基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系“的问题

    https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=sjrand&0.8967564508222368 这是图片的访问网址 大家看清楚 ...

  3. Swift 必备开发库 (高级篇)

    1.CryptoSwift swift加密库, 支持md5,sha1,sha224,sha256... github地址: https://github.com/krzyzanowskim/Crypt ...

  4. RPC 135端口

  5. Linux驱动开发学习笔记(1):LINUX驱动版本的hello world

    1.关于目录    /lib/modules/2.6.9-42.ELsmp/build/   这个是内核源码所在的目录    一般使用这样的命令进入这个目录:cd /lib/modules/$(una ...

  6. THEOS makefile

    转自https://www.h4ck.org.cn/2013/07/theos-makefile/ theos的makefile写法与其他linux/unix环境下的makefile写法大同小异,但是 ...

  7. Android防止按钮连续点击

    为了防止用户或者测试MM疯狂的点击某个button,写个方法防止按钮连续点击. public class Utils { private static long lastClickTime; publ ...

  8. 通过Typings为Visual Studio Code增强智能提示功能

    缘起 最近在学习Node.js及ThinkJS这个框架,用vscode作为开发环境.默认情况下vscode对ThinkJS的代码提示并不好,所以研究了一下,原来可以同通过Typings来让vscode ...

  9. LOB字段存放在指定表空间 清理CLOB字段及压缩CLOB空间

     LOB字段存放在指定表空间 清理CLOB字段及压缩CLOB空间    把LOB字段的SEGMENT 存放在指定表空间.清理CLOB字段及压缩CLOB空间 1.创建LOB字段存放表空间:create ...

  10. ATA/SATA/SCSI/SAS/FC总线简介

    ATA/SATA/SCSI/SAS/FC 都是应用于存储领域的总线,在当今的存储系统中,普遍应用的硬盘接口主要有 SATA . SCSI . SAS 和FC , ATA 比较古老,在一些老的低端存储系 ...