PDA

View Full Version : [SOLVED] perl: warning: Setting locale failed.



ejmadar
December 5th, 2009, 03:05 PM
All other threads were closed already, so i started a new one. It may spare some time for you.

I have a virtual private server running Ubuntu 9.10 and got messages like this:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
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_CTYPE to default locale: No such file or directory
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 directoryTo get rid of the messages I had to run this command:


# locale-gen en_US en_US.UTF-8 hu_HU hu_HU.UTF-8then


# dpkg-reconfigure localesThe problem was solved. I didn't had to edit any files like /etc/environment
Hope it helps for you!

I found the solution here:
http://www.linuxquestions.org/questions/showthread.php?p=3540541#post3540541

gerrywastaken
March 16th, 2010, 02:49 AM
didn't fix the error for me

sneils
March 18th, 2010, 02:13 PM
Worked fine for me, thx. :)

ajeje
May 3rd, 2010, 09:03 AM
Works for me as well! Thanks.

matthewboh
July 27th, 2010, 10:56 AM
Didn't work for me either

Dafydd
September 23rd, 2010, 03:30 PM
Didn't work for me either

Worked perfectly for me (Ubuntu 10.04). I just ran:

sudo locale-gen en_US en_US.UTF-8 cy_GB.UTF-8


Replaced hungarian (hu) for Welsh (cy).

glendeni
January 30th, 2011, 06:48 AM
Worked for a new install of 10.04 with added KDE desktop, for which running many applications (perl, firefox) gave "setting locale" error messages when run in Konsole. "sudo locale-gen en_US en_US.UTF-8" solved that problem for me. I kiss the toes of ejmadar (http://ubuntuforums.org/member.php?u=971525) for saving me _much_ time and aggravation .

demauk
April 1st, 2011, 04:53 AM
You need to pay attention to your error message and issue a command for your missing locale.

For example, this is the error I got:


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_CA:en",
LC_ALL = (unset),
LANG = "en_CA"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

The LANG string is the one you need. So, in my case this command solved my problem:


$ sudo locale-gen en_CA

Heels
April 8th, 2011, 03:20 PM
Hi all,

I installed ubuntu 10.10 a week ago, and got my vodaphone mobile broadband up and running. then some update was installed (usb modeswitch something) and... I couldn't get vodaphone to start. I got the same issues a in this thread, and with your suggestions I've actually managed to get it running (even though I don't have a clue what I'm actually doing :D). So now the application starts up, says its connected, but then I STILL have no internet.

The wierd thing is: when I left click on the internet icon, I can check enable mobile broadband, but as soon as I touch anything in firefox, the 'check mark' has disappeared...

So: 1) thanks for all your help so far, and 2) has anyone got a clue what I can try now??

willPower
April 10th, 2011, 11:31 PM
Hi all,

I installed ubuntu 10.10 a week ago, and got my vodaphone mobile broadband up and running. then some update was installed (usb modeswitch something) and... I couldn't get vodaphone to start. I got the same issues a in this thread, and with your suggestions I've actually managed to get it running (even though I don't have a clue what I'm actually doing :D). So now the application starts up, says its connected, but then I STILL have no internet.

The wierd thing is: when I left click on the internet icon, I can check enable mobile broadband, but as soon as I touch anything in firefox, the 'check mark' has disappeared...

So: 1) thanks for all your help so far, and 2) has anyone got a clue what I can try now??

You could try starting a new thread.

Heels
April 11th, 2011, 11:10 PM
gee, thanks! :D :D :D

stoof
April 16th, 2011, 08:51 PM
You need to pay attention to your error message and issue a command for your missing locale.

For example, this is the error I got:


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_CA:en",
LC_ALL = (unset),
LANG = "en_CA"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

The LANG string is the one you need. So, in my case this command solved my problem:


$ sudo locale-gen en_CA

THIS.

Thank you.

kuhnza
October 30th, 2011, 12:39 PM
You need to pay attention to your error message and issue a command for your missing locale.

For example, this is the error I got:


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_CA:en",
LC_ALL = (unset),
LANG = "en_CA"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

The LANG string is the one you need. So, in my case this command solved my problem:


$ sudo locale-gen en_CA
Great answer, did the trick for me.

Thanks!

amd-64
February 29th, 2012, 04:31 AM
I found I needed to add


setenv LANG "en_CA"
setenv LANGUAGE "en_CA.UTF8"

The quotation marks are absolutely necessary. I inserted these in my .tcshrc source file and now everything is fine. Not sure if it is dependent on CSH/TCSH.

Hope this helps

2uRcJQ34G1
October 7th, 2012, 03:13 PM
Worked for me thanks!

Magnificent 7
December 9th, 2012, 08:35 AM
Thanks ejmadar, solution still working on a Virtual Private Server running 12.04 Server.



root@vps:/# locale-gen en_GB.UTF-8
Generating locales...
en_GB.UTF-8... done
Generation complete.


Before:



root@vps:/# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
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
LANG=en_GB.utf8
LANGUAGE=
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=


After:


root@vps:/# locale
LANG=en_GB.utf8
LANGUAGE=
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=

studiogrynn
February 12th, 2013, 03:02 AM
Worked great! Thank you!!

wesswei
February 21st, 2013, 12:33 AM
Sweet, fixed for me!

epasha
March 15th, 2013, 02:31 PM
Thank's you. For russuan

# sudo locale-gen ru_RU ru_RU.UTF-8 ru_RU ru_RU.UTF-8

CritiKaster
November 16th, 2013, 07:35 PM
This was in the right direction, but unfortunately, didn't fix it for me. What did, however, was this:

http://bookmarks.honewatson.com/2009/05/30/perl-warning-please-check-that-your-locale-settings-ubuntu/

EDIT:

Further investigation shows the fix in my case was even easier than I thought, before:


$ locale
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
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

So I set LC_TYPE and LC_ALL manually like so:


$ export LC_TYPE="en_US.UTF-8"
$ export LC_ALL="en_US.UTF-8"

The result is a fix:


$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

SECOND EDIT:

.. Unfortunately, the above 'solution' only worked for that terminal session. As soon as I reconnected, locale errors rained down on me again..

Delving furhter into this issue, I came across:
http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl

What permanently fixed it for me is commenting out the following directive in my /etc/ssh/sshd_config (on the remote host):


AcceptEnv LANG LC_*

Having eliminated that line, and reloading my ssh daemon, this issue was resolved.