When I ssh
into an EC2 instance running Ubuntu 18.04, I get this error:
manpath: can't set the locale; make sure $LC_* and $LANG are correct
I tried this but this didn't fix it:
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
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_TERMINAL_VERSION = "3.3.7",
LC_CTYPE = "UTF-8",
LC_TERMINAL = "iTerm2",
LANG = "C.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
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",
LC_TERMINAL_VERSION = "3.3.7",
LC_TERMINAL = "iTerm2",
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",
LC_TERMINAL_VERSION = "3.3.7",
LC_TERMINAL = "iTerm2",
LANG = "C"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Another option is to disable sending LC_* environment variables. Refer to https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh , these steps fits for MacOS ssh client :
Find these settings:
Change it to :
Save the file, then try connecting again.
Thanks to Gunnar Hjalmarsson I'm able to use this workaround:
unset LC_CTYPE
in~/.profile
I don't have enough reputation to comment, but I want to build on the YudhiWidyatama answer.
Would be the right answer. Disabling this policy for every host seems a bit too drastic.