2

I ssh to my Raspberry Pi running Raspian from my mac and try to run tmux, but I'm getting this error:

tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968

As suggested elsewhere, I commented

#   SendEnv LANG LC_*

in /etc/ssh/ssh_config on my macbook and

#AcceptEnv LANG LC_*

in /etc/ssh/sshd_config on the Raspberry Pi. Both should prevent the Pi from getting a hickup because of the locale on the mac.

The output of locale is this:

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

It has sometimes been en_GB.UTF-8 instead of POSIX, don't know why that keeps changing. In /etc/default/locale I added

LC_ALL=en_GB.UTF-8

but that doesn't seem to have any effect.

Exporting LC_ALL=en_GB.UTF-8 on the command line does work and I guess I could put it in .bashrc, but that seems like a cheap hack for something where there should be a sound solution. I ran locale-gen and raspi-config/localization a zillion times and rebooting, without a lasting effect.

How is localization configuration done properly?

  • 1
    Had the same problem. This worked for me unix.stackexchange.com/a/278401/307353 . You have to use 'sudo' to run the commands – Dirk Sep 25 '18 at 19:47
  • Ok, so in /etc/locale.gen I commented #en_GB.UFT-8 and uncommented en_US.UTF-8, ran locale-gen again and voila, problem gone. What is the lesson to be learned here? Use US locales, they work? – user1785730 Sep 25 '18 at 20:14
  • I left both uncommented and selected GB as the default. On one Pi it actually still worked after swapping back to GB. – Dirk Sep 25 '18 at 20:17
  • It is unclear from your question HOW you tried to set locale. This CAN be done manually, but requires a number of steps. raspi-config is the recommended method, as this generates and installs ALL the files required. The error suggests you have not correctly setup; I suggest you use a UTF-8 locale. I use en_AU.UTF-8 UTF-8 you should try en_GB.UTF-8 UTF-8 – Milliways Sep 26 '18 at 1:19
  • Not sure what you mean. As I said, I ran raspi-config localization more than once. – user1785730 Sep 26 '18 at 11:00
1

This issue can have multiple causes. Apart from improperly configured locales and SSH env settings which have already been covered here, my particular case was solved by setting UsePAM yes in /etc/ssh/sshd_config. This was the default setting, but the Foundation Security Documentation recommended changing it to no.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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