perl: warning: Setting locale failed.

2 minute read Modified:

Why does this happen?

When I logged in from my laptop to nameserver and ran nsvi, I got the following message:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en",
        LC_ALL = (unset),
        LC_MEASUREMENT = "nl_NL.UTF-8",
        LC_PAPER = "nl_NL.UTF-8",
        LC_MONETARY = "nl_NL.UTF-8",
        LC_NAME = "nl_NL.UTF-8",
        LC_ADDRESS = "nl_NL.UTF-8",
        LC_NUMERIC = "nl_NL.UTF-8",
        LC_TELEPHONE = "nl_NL.UTF-8",
        LC_IDENTIFICATION = "nl_NL.UTF-8",
        LC_TIME = "nl_NL.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

But when I login from my normal computer, this does not happen.

During the search of a solution I found it was easy to trigger by using a simple perl command:

perl -e exit

Which locales are in use?

When I checked which locales were set, I got different answers from my normal computer than from my laptop. My normal computer has no locales set:

$ set | grep "^LC"
$
But my laptop has:
$ set | grep "^LC"
LC_ADDRESS=nl_NL.UTF-8
LC_IDENTIFICATION=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_MONETARY=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_NUMERIC=nl_NL.UTF-8
LC_PAPER=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8
$
That was the biggest different between the systems. Since I use the dutch locale on my laptop, I didn’t want to stop using that. And I didn’t want to add that locale to the nameserver, because it is not needed there.

The solution

I found a good explanation on stackoverflow. The question was how to fix the problem. Normally I would like to fix it in my local ~/.ssh/config file, but that is not possible because of the following quote from ssh_config(5):

Multiple environment variables may be separated by whitespace or spread across multiple SendEnv directives. The default is not to send any environment variables.

I decided to change the /etc/ssh/ssh_config on the laptop and comment the following line:

SendEnv LANG LC_*

After changing the config, I logged in to the nameserver again and the issue was solved:

$ set | grep "^LC"
$ perl -e exit
$
Recent posts
- full list -