Problem with locale

7 posts
by discopimp » Fri Jul 20, 2012 10:00 am

just got my pi today and installed Debian Wheezy on it ... everything seems to run fine except i am getting the following errors all the time:

Code: Select all
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
   LANGUAGE = (unset),
   LC_ALL = (unset),
   LC_CTYPE = "UTF-8",
   LANG = "en_GB.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

I have tried to set the locale via:

Code: Select all
export LC_ALL=en_GB
export LANGUAGE=en_GB

or putting this directly into /etc/environment

Code: Select all
LC_ALL = en_GB
LANG = en_GB

or trying:

Code: Select all
apt-get install locales-all


Code: Select all
dpkg-reconfigure locales

nothing seems to work, i still get the error/warning everytime i install sth via apt-get

what am i missing ?
Posts: 1
Joined: Fri Jul 20, 2012 9:32 am
by roppert » Sat Jul 28, 2012 12:05 pm
You should be able to fix it with Raspi-config. To start it just run:
Code: Select all
sudo raspi-config
Select change_locale and then make sure the locale you want to use is selected in the list. If not then select it and select OK and it will be built for you.
Posts: 1
Joined: Sat Jul 28, 2012 11:59 am
by bredman » Sat Jul 28, 2012 7:57 pm
Does this problem happen if you are using a particular program on the RPi, or is it when you use SSH from another computer?

If it happens when using SSH, this is a fault on the SSH client, not the RPi. For example using an Ubuntu machine as the SSH client will cause this problem.

To fix this SSH problem, edit the file /etc/ssh/ssh_config on the SSH client (not the RPi) and remove the line
SendEnv LANG LC_*

This stops the client sending invalid locale information to the RPi.
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm
by MacValley » Wed Feb 27, 2013 9:37 pm
Thanks bredman, your tip worked for me.
In my case, however, the conf file is /etc/ssh_config (ssh client on Mac Mountain Lion, 10.8.2). I commented like this:
# SendEnv LANG LC_*
and now I can even run python scripts on the raspberry that earlier caused errors like
"UnicodeEncodeError: 'ascii' codec can't encode character ..."
Posts: 6
Joined: Wed Feb 27, 2013 7:16 pm
by rez » Thu Apr 11, 2013 9:26 am
Bredman thank you so much!!

This has been annoying me for a while.... it didn't break anything but every time it cropped up I ended up messing with the locale settings on my pi and not getting anywhere and giving up.

Never thought it could be the client side.... hashed out that from my ssh_config on the client and all is well again....... THANK YOU!!!
Posts: 2
Joined: Tue Jul 17, 2012 9:01 pm
by wickedsight » Thu Aug 29, 2013 12:27 pm
Thanks a lot, tried so many things to fix this already.

Also, for newbs like me, after changing this don't forget to restart the ssh connection.
Posts: 3
Joined: Thu Aug 29, 2013 12:25 pm
by femindharamshi10 » Fri Jan 15, 2016 2:04 pm
Even i am having problems with this... deluge-web doesnt work because of this problem... when i try to change locale to en_US UTF-8 it again gives me error Cannot set LC_CTYPE etc... and again i am back to the same prolem
Posts: 102
Joined: Thu Jan 07, 2016 1:28 pm