21

Every time I login to my CentOS 6 server through SSH I get this error

Can anyone please explain what does that error mean & how to fix?

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
Nakilon
  • 34,866
  • 14
  • 107
  • 142
Seif Hatem
  • 1,433
  • 2
  • 12
  • 20

3 Answers3

59

The Fix: Thanks for Millie Smith (https://stackoverflow.com/users/2850543/millie-smith) & http://linuxforums.org.uk/index.php?topic=10318.0

Using root user through ssh

Run these commands

vi /etc/environment

& add these lines:

LANG=en_US.utf-8
LC_ALL=en_US.utf-8
Community
  • 1
  • 1
Seif Hatem
  • 1,433
  • 2
  • 12
  • 20
  • Thanks for this solution! Using CentOS 7.2, it worked for me but writing the lines this way (note the uppercase): `LANG=en_US.UTF-8` `LC_ALL=en_US.UTF-8` – Jonatan Ienco Jan 01 '16 at 22:46
3

Before connecting to the host via SSH, you can set LC_ALL to C, e.g.

LC_ALL=C ssh user@example.com
kenorb
  • 155,785
  • 88
  • 678
  • 743
1

I try yum reinstall glibc-common from there and @Seif Hatem's method.

but it don not work.

you can use try this.

It works.

export LANG=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="en_US.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_ADDRESS="en_US.UTF-8"
export LC_TELEPHONE="en_US.UTF-8"
export LC_MEASUREMENT="en_US.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"
export LC_ALL=en_US.UTF-8

https://github.com/2creatives/vagrant-centos/issues/7

vsxen
  • 731
  • 5
  • 5