Introduction
If you execute a Perl script, call the Perl binary or see this error when you log into your server via SSH, then you may attempt to resolve it by performing the following steps.
The most common cause for this issue is due to the language/locale settings in use by the client machine that is connecting via SSH.
If your client machine uses a different locale, your SSH connection likely forwards the environment settings over via SSH to the connecting server, and if the locale environments sent are not supported, you may encounter this message.
In the example below, the issue was due to the following unrecognized locale setting:
LANG = "en_US.UTF-8 LC_ALL=en_US.UTF-8"
The server in this example does not recognize "en_US.UTF-8 LC_ALL=en_US.UTF-8" so this message is displayed upon login.
Perl: warning: Setting locale failed.
Perl: warning: Please check that your locale settings:
LANGUAGE = "",
LC_ALL = (unset),
LANG = "en_US.UTF-8 LC_ALL=en_US.UTF-8"
are supported and installed on your system.
Perl: warning: Falling back to the standard locale ("C").
Procedure
One way to work around this without having to change your client machine's language settings is by simply specifying the variables directly before your SSH connection.
Since the LANG variable was causing issues, we can use one of the supported locales on the server.
To obtain a list of compatible locales, run the following command in your server:
locale -a
In this example, we will use the standard US English with UTF8 support.
en_US.UTF-8
So we craft our SSH command as follows:
LANG="en_US.UTF-8" ; ssh -p $PORT $HOSTNAME
This will ensure that when you SSH to your server, an adequately supported locale is passed in the environment variables and prevents this message from appearing.
If you would like to make these changes permanent, then you can simply set these variables on your client machine via an environment configuration file such as .bashrc
, .bash_profile
etc..
In this example, on a Mac I am setting the variable via the .profile
configuration file.
[user ~]$ echo 'LANG="en_US.UTF-8"' >> .profile && source .profile
Comments
0 comments
Article is closed for comments.