[Problem Solving] perl: warning: Setting locale failed.

27th dic 2011Unix, ,

In my Ubuntu 10.04 at linode.com I was running again and again into this error:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TYPE = “en_US”,
LC_MESSAGES = “en_US”,
LC_COLLATE = “en_US”,
LANG = “en_US.UTF-8″
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

I solved issuing the following commands, you may need to tailor them to your needs:


root@hostname:~# export LANGUAGE=en_US.UTF-8
root@hostname:~# export LANG=en_US.UTF-8
root@hostname:~# export LC_ALL=en_US.UTF-8
root@hostname:~# locale-gen en_US.UTF-8
Generating locales…
en_US.UTF-8… up-to-date
Generation complete.
root@hostname:~# dpkg-reconfigure locales
Generating locales…
en_US.UTF-8… up-to-date
it_IT.ISO-8859-15@euro… done
it_IT.UTF-8… done
Generation complete.

Hope this could save your day since I wasn’t able to save mine… :-)