When I run perl
, I get the warning:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset
If you don't care about the locale issue, you can set PERL_BADLANG=0. Of course, this could result in incorrect localisation.
You need to configure locale appropriately in /etc/default/locale
, logout, login, and then run the regular commands
root@host:~# echo -e 'LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8' > /etc/default/locale
root@host:~# exit
local-user@local:~$ ssh root@host
root@host:~# locale-gen en_US.UTF-8
root@host:~# dpkg-reconfigure locales
Adding the following to /etc/environment
fixed the problem for me on Debian and Ubuntu (of course, modify to match the locale you want to use):
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
Use:
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
It works for Debian. I don't know why - but locale-gen had not results.
Important! It's a temporary solution. It has to be run for each session.
This generally means you haven't properly set up locales on your Linux box.
On Debian or Ubuntu, that means you need to do
$ sudo locale-gen $ sudo dpkg-reconfigure locales
See also man locale-gen.
For anyone connecting to DigitalOcean or some other Cloud hosting provider from the iTerm2.app on MacOS High Sierra and getting this error on some commands:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "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").
This fixed the problem for me:
I know this thread is old but maybe somebody will find this useful. I know how annoying this can be.