вторник, 14 мая 2013 г.

Debian Locales error fix


If you get similar messages to this when you use apt-get
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"
    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

and the advice to
dpkg-reconfigure locales
doesn’t work? then try this –
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
Short and sweet solution.
If after logout you still has errors, try this:

LC_CTYPE, LC_ALL problems on a fresh install of Debian Squeeze
Last few times I’ve installed a fresh copy of Debian Squeeze, I’ve had the following errors show up during/after a routine apt-get update;apt-get upgrade:

locale: cannot set LC_CTYPE to default locale: No such file or directory

After that point I could reproduce the error by typing: locale -a

You will find tons of people on Google having the same problem, a lot of solutions offered, but I feel your frustration and here is your fix below.

Just to make sure we’re both in the same situation, do these:

1) Check your /etc/locale.gen and see that the locale you wish to choose is uncommented. (mine was en_US.utf8)
2) Type ‘locale-gen’ as root, should be no errors here.
3) Edit /etc/environment and add the following lines:
LANG=en_US
LC_CTYPE=en_US.utf8
4) That’s it. Logout and log back in. ‘locale -a’ should give no errors. Enjoy.