I occasionally get locale errors and I've tried to run dpkg-reconfigure locales to fix the problem. Here's the output:

:~$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    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 = (unset),
    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 = (unset),
    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").

I looked for /usr/bin/locale but it doesn't exist on my system. Do I need to create it? What do I put in there?

Also I found a related question that says the cause of his problem was in the sshd_config file. The file had the following entry:

AcceptEnv LANG LC_*

I'm mainly concerned that it may cause problems for my VPS, otherwise if it's nothing major I'll be happy to ignore the problem. What should I do? thanks!

link|improve this question
feedback

3 Answers

If you are getting the errors while ssh'ing to a remote system, and don't want to modify the remote system (by changing the sshd_config, for instance), you can do the following on your local system (assuming bash)

export LC_ALL=en_US
export LANGUAGE=en_US

and then ssh user@remote

link|improve this answer
feedback

I've seen this before on older Debian installs, and while annoying, I've never seen it cause a problem.

If

  /usr/bin/locale 

is missing, try (as root):

  apt-get install libc-bin

that should install libc-bin, providing /usr/bin/locale.

That AcceptEnv line in your sshd_config is pretty standard, and shouldn't be the the cause of your problem here.

link|improve this answer
libc-bin was already installed, so I updated it and tried running dpkg-reconfigure locales again. No joy :( – blogjunkie Aug 17 '11 at 11:24
Does /usr/bin/locale exist now? If so, what is the output of: locale -a and what is in /etc/default/locale ? – Chad Feller Aug 17 '11 at 13:23
The contents of `/etc/default/locale' : # File generated by update-locale LANG=en_US.UTF-8 – blogjunkie Aug 17 '11 at 16:53
locale -a gives me: locale: Cannot set LC_CTYPE to default locale: No such file or directory C en_US.utf8 POSIX – blogjunkie Aug 17 '11 at 16:54
apt was claiming that libc-bin was installed, but at least one file was missing (/usr/bin/locale), and reinstalling libc-bin seems to have fixed that. Can you try apt-get install --reinstall locales? Then, for good measure, try locale-gen, which will regenerate any locales that are uncommented in /etc/locale.gen (you should have a line like en_US.UTF-8 UTF-8). After this, see if locale -a works. – Chad Feller Aug 17 '11 at 20:23
show 1 more comment
feedback

Did the following, as Manoj, but added it to #~/.bashrc:

export LC_ALL=en_US.utf8
export LANGUAGE=en_US.utf8
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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