Raspberry Pi / Raspbian: SSH locale issues on OS X

Here I am, back among the living with something related to the Raspberry Pi I’ve just got today:
When connecting via SSH from a OS X machine, it tries to use the same locale as on the client computer which results in those messages:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LC_MESSAGES = “en_GB.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

To solve this, edit /etc/ssh_config by typing
sudo nano /etc/ssh/ssh_config

and put a # at the beginning of the line starting with SendEnv LANG LC...

Save, close and reconnect your SSH session and everything should be fine.

8 Responses to “Raspberry Pi / Raspbian: SSH locale issues on OS X”

  1. Adam says:

    This did not work for me. I’m still getting the same error as before.
    I don’t think that is a “correct” solution to the problem. Your issue is probably due to that you have a locale in the ssh-client that does not exist in the ssh-server.

    I solved the problem by manually adding all required locales to /etc/default/locale

    In my case the file now looks like this:
    LANG=en_US.UTF-8
    LC_ALL=”en_US.UTF-8″
    LANGUAGE=”en_UTF.UTF-8″

  2. admin says:

    Hejsan, Adam.
    This is strange, my “solution” totally did the trick for me.
    But yours is probably more elegant… by far. Thanks for your comment!

  3. Juergen Rose says:

    I have the same issue. In /etc/default/locale I find:

    # File generated by update-locale
    #LANG=en_GB.UTF-8

    So it looks if this file is generated, and the changes should be done at an other place.
    On the other hand I did the changes as Adam suggested and run then ‘update-locale’ and my changes were not overwritten. Any idea, what is the correct procedure?

  4. Juergen Rose says:

    Googling a little bit more I found that doing

    dpkg-reconfigure locales

    is the right way.

  5. Al says:

    Hi Martin, thanks for this! It worked for me, but only when I updated the ssh_config on the Mac side (/etc/ssh_config). Changing the ssh_config on the Pi did nothing (etc/ssh/ssh_config). Maybe that was why it didn’t work for Adam?

    Manually changing /etc/default/locale is not generally recommended, as it is a generated file.

  6. daved says:

    I just found that if you don’t set your locale properly in raspi-config (or original setup), you get those warnings. After you set your locale, it then asks for your Default Locale and gives you two options: None (selected by default), or the option you selected above. You need to select your option, then you won’t get those warnings.

    Cheers

  7. iMitwe says:

    Put in /etc/environment

    LC_ALL=C

  8. Cesco says:

    raspi-config and set the locale before anything else.

Leave a Reply

Your Data

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

What do you want to say?