Configure Locales on Debian

2

I have a problem to generate the Locales on my server (Debian 7.5 stable (Wheezy) (64bits)). When I run, as a root:

dpkg-reconfigure locales

And select en_US.UTF-8, I get the following logs:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_GB:en",
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_GB:en",
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_GB:en",
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
sh: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

Any idea why?

Thank you!

Cohars

Posted 2014-10-29T23:08:20.880

Reputation: 123

Answers

2

Apparently you have LANGUAGE=en_GB:en in your environment, but you have not selected en_GB or other en variations to be generated (the first part of the dpkg-reconfigure locales).

You probably had en_GB as your old default but have now removed those from the list of locales to generate. However your environment still has the old setting, so perl is complaining that it can't find the (old) locale. That's not a problem per se for English-speaking people, the fallback locale is perfectly readable, so not really a problem.

Logging out and logging in again will pick up the new settings, alternatively you could do

source /etc/default/locale

from your shell.

Certain applications may not always have localization for your particular locale available; in such cases starting such an application as follows may help, as the C locale should always be available:

env LC_ALL=C applicationname

wurtel

Posted 2014-10-29T23:08:20.880

Reputation: 1 359

Ok, thanks. I didn't knew de /etc/default/locale file. I just changed it to US. The problem is that I add errors when launching some services. Well, problem solved. – Cohars – 2014-10-30T13:13:32.777

I still have that: Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly. when I run mongo on the server. Can't find how the set it. – Cohars – 2014-10-30T14:32:42.513

1How do you start mongo? Via a script? If so, check whether that script has any LANG and/or LC_* settings (remove them if so). Otherwise try export LC_ALL=C before starting mongo. – wurtel – 2014-10-30T15:00:24.490

Currently I'm just trying to run the command. – Cohars – 2014-10-30T15:05:27.523

So did you try the export command I gave? Please read responses carefully, this is not a chat system. – wurtel – 2014-10-30T15:06:09.570

Yes sorry, forgot to say it works with the export! – Cohars – 2014-10-30T15:09:30.897