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!
first:
then:
and the famous:
This rids the system of locales, then re-installs locales and downgrades libc6 from 2.19 to 2.13 which is the issue. Then configures locales again.
If this happens when SSHing to your box, but not on console, try reconfiguring your ssh client (on your local machine). On Mac OS X for example edit /private/etc/ssh_config and comment out
Thanks to the post of bredman on the Rasberry Pi Bulletin Board.
I had this problem for a long time and all the usual advice about dpkg-reconfigure locales, locale-gen, etc didn't help. So I played around a little bit with the environment variables, and what I found was that the system was borking on the
LC_CTYPE
environment variable!UTF-8
is not a valid value for it. Setting it toen_US.UTF-8
fixed it.To make the change permanent, I ran
which writes to
/etc/default/locale
. And then reboot the system for it to take effect completely.If you disabled PAM authentication for ssh in
/etc/ssh/sshd_config
(UsePAM no
) the responsible configuration in/etc/pam.d/login
isn't effective:session required pam_env.so readenv=1 envfile=/etc/default/locale
The result:
/etc/default/locale
seems to have no effect.So you have to configure your client to send the LANG vars or export the env vars in the profile scripts like
~/.profile
,~/bashrc
etc.More: http://wiki.debian.org/Locale#Standard
I've seen this before on older Debian installs, and while annoying, I've never seen it cause a problem.
If
is missing, try (as root):
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.
Did the following, as Manoj, but added it to #~/.bashrc:
Mac connecting to a fresh Debian 10 install. None of the answers googled all over Stack Exchange helped. Here's what did (and was straightforward and reliable too):
Run this on your Debian box and it will stop the connecting mac terminal from messing up the server locales (more info).
As a bonus, that may even improve security of the server.
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)
and then
ssh user@remote
On my fresh Debian installation (minimal) locales was completely missing. Installing it (
aptitude install locales
) and runninglocale-gen
did the trick though. So guys, do as Chad Feller mentioned but check for having the packagelocales
installed first.I was using German VPS and couldn't change locale because there was no English language pack installed.
After installing I could finally change locale