Centos 5.8 locale warning

Poe asked:

A friend is running CentOS 5.8 on his server. It’s a mostly harmless error but I’m tired of seeing it. I’m more familiar with debian, so I’m not sure how to generate or reconfigure locales. The usual binaries (locale-gen, dpkg, etc. ) I’m used to aren’t on this server.

[root@localhost]# git pull origin master
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_GB:en",
    LC_ALL = "en_US.utf8",
    LANG = "en_GB"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
From git.com:www
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Everything seems fine with the locales.

LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8

And it is a supported locale.

[root@localhost]# locale -a | grep en_US
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8

My answer:


The problem here is that you use a different locale setting on your personal system, than is installed on the server you sshed to.

Your local system uses en_GB while the remote system uses en_US.utf8. (Or I might have these reversed…either way, they don’t match.)

So when you ssh to the system, your locale settings are passed along, but the remote system doesn’t have locales installed to handle the en_GB language, so it falls back to the C locale.

You can resolve this in one of three ways:

  1. Change your local system to en_US.utf8. I see in your other question that this is what you did (due to Mac OS X’s ssh being a little weird with locales).
  2. Install the en_GB locales on the remote system. On Red Hat 5 derived systems, you install the appropriate package group. On Red Hat 6 derived systems, all supported languages are always installed by default (though certain packages have their own language packs that also must be installed).
  3. Since the error is (in this case) completely harmless, ignore it.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.