Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I noticed on some VPS's, locales is not installed by default so dpkg-reconfigure locales will only throw an error saying that locales is not installed.

I want to do apt-get install locales, I've done this a couple times and I know this sets up the locales, but it would also start to throw warnings despite configuring itself to work, hence every package thereafter will not complain with something like:

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 directory

But should I do something like edit /etc/environment and manually set environment variables like LC_ALL to en_US.UTF-8 to make sure the installation of locales goes fine? Or does it not even matter because I'll only install it one time and despite it throwing warnings when trying to install itself, since it will work after that, not worry about it?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

You do not have to worry about these warning messages, they are not about the actual installation or configuration but about the presentation of messages to you (and very rarely anything serious in that department either).

share|improve this answer
add comment

I'm calling bullshit on the 'this doesn't matter' answers. for one, the constant errors in the console unable to set the locale is extremely annoying. but this is not all, some things really will not work.

I just solved this on a new VPS. a short summary:

locales need to be generated before they can be used. I'm not sure about other distributions so following is a summary for debian/ubuntu.

first just try to run dpkg-reconfigure locales. this should set it up on some debian distros. but I stumbled at some that don't. this probably means that you need to reconfigure smth else there but I din't find it so I figured out a more manual way to do the same:

older debian/ubuntu stored the supported locales in /etc/locale.gen, newer store it in /var/lib/locales/supported.d/local

you can tell which one you have by checking if the directory /var/lib/locales/supported.d/ exists or not.

to generate en_US.UTF-8 locale put the following string in this file: en_US.UTF-8 UTF-8 then run locale-gen to generate the locales.

you can confirm that generation worked by running locale -a to list all available locales.

now you need to configure your shell to set the locales. just edit /etc/default/locale and put the following there: LANG=en_US.UTF-8

now you can exit your shell and come back to check that echo $LANG prints en_US.UTF-8

that should be it.

share|improve this answer
    
this fixed it in a VPS that I had rented. It was running Ubuntu Server 12.04.3 LTS on OpenVZ –  zipizap Dec 16 '13 at 15:58
add comment

I personally have yet to see an error when having an unset locale, but I don't deal with unicode or multilingual systems much, so I'm not certain if I work as a good sample for its urgency.

As for setting the locale, the guaranteed way to set it on your system is to edit /etc/locale.gen so that the locales you're presently in are uncommented, and then running

# genlocale

under root. Also, this method is generally cross platform for all linux systems.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.