Fix stubborn 'Setting locale failed.'

Posted by user60129 on Server Fault See other posts from Server Fault or by user60129
Published on 2011-02-04T07:06:04Z Indexed on 2012/10/07 15:39 UTC
Read the original article Hit count: 183

Filed under:
|

I have a very stubborn, well-known locale error on Ubuntu 9.10:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "custom.UTF-8",
    LANG = "en_US.UTF-8"

Tried the following:

  • Added LANG=en_US.UTF-8 and LC_ALL=en_US.UTF-8 to /etc/environment
  • Run apt-get install --reinstall locales (error: perl: warning: Falling back to the standard locale ("C"). /usr/bin/mandb: can't set the locale; make sure $LC_* and $LANG are correct)
  • Run sudo dpkg-reconfigure locales. Result: Cannot set LC_ALL to default locale: No such file or directory, and then updates locales all locales including en_US.UTF-8
  • sudo locale-gen updates all locales successfully, including en_US.UTF-8
  • sudo locale-gen un_US en_US.UTF-8 gives no error nor other output
  • In /etc/default/locale it says LANG="en_US.UTF-8"
  • echo $LANG gives en_US.UTF-8
  • /var/lib/locales/supported.d/local says en_US.UTF-8 UTF-8
  • locale -a gives me:
C
en_AG
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
POSIX

So well... I am pretty much out of options I can think of. Anybody any idea??

Thanks!

© Server Fault or respective owner

Related posts about ubuntu

Related posts about locale