Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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").
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Everything seems fine with the locales.


And it is a supported locale.

[root@localhost]# locale -a | grep en_US
share|improve this question

What are the contents of /etc/sysconfig/i18n?

I typically set all of my servers to LANG="C" in that file. It's part of my build script, but it's helped me avoid terminal and emulation issues over the years. I'll update this with the real explanation later.

# /etc/sysconfig/i18n

share|improve this answer
In my case the content of cat /etc/sysconfig/i18n LANG="en_US.UTF-8" SYSFONT="latarcyrheb-sun16" and changing LANG="C" alone didn't give expected result – Hugo Dec 12 '12 at 14:08
Try changing the setting I specified, then log out and log in again. Test the git pull. – ewwhite Dec 12 '12 at 14:09
this fixed the git pull, but when I'm logging in there still is a message -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8) and perl -v outputs the same error message mentioned in initial post – Hugo Dec 12 '12 at 14:46
We'd need to see the .bash_profile or .bashrc of the user, or to see if there are any additional items defined in the system-wide files. Try logging in as a different user, for instance. – ewwhite Dec 12 '12 at 15:00
They are the default .bash_profile and .bashrc files - nothing changed I found out that adding LC_CTYPE="en_US.UTF-8" to /etc/sysconfig/i18n solved the problem – Hugo Dec 13 '12 at 13:44

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.
share|improve this answer

This seems like a perl issue. Newer versions of perl doesn't have this issue. See output from my system:

$ perl -v

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LC_TYPE = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

This is perl, v5.8.6 built for x86_64-linux-thread-multi

Now see this output:

$ LC_ALL=C perl -v

This is perl, v5.8.6 built for x86_64-linux-thread-multi

Copyright 1987-2004, Larry Wall

Seems like perl 5.8.6 doesn't like the UTF-8 output?? Setting LC_ALL=C got rid of the warning.

I installed another version of perl (5.18) and that works with UTF-8 setting without any warning.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.