6

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!

5 Answers5

9

You could also try to install the locales-all package, to avoid having to generate any locales ever again.

Teddy
  • 5,134
  • 1
  • 22
  • 27
3

Had the same problem and found the solution. You have to recreate the custom.UTF-8 locale def (the "custom" file is probably there because you changed the date or time format). Run

sudo localedef -f UTF-8 -i custom custom.UTF-8

Another way to do this is to add the locale to the ones you want dpkg-reconfigure locales to configure for you. On Debian:

echo 'custom.UTF-8 UTF-8' |sudo tee -a /etc/locale.gen
sudo dpkg-reconfigure locales

On Ubuntu:

echo 'custom.UTF-8 UTF-8' |sudo tee -a /var/lib/locales/supported.d/local
sudo dpkg-reconfigure locales

Hope this helps!

Tobu
  • 4,367
  • 1
  • 23
  • 31
Gregor
  • 46
  • 1
1

I solved the same problem on a Ubuntu 10.04 server this way:

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
root@hostname:~# dpkg-reconfigure locales

Hope this could help.

Darme
  • 253
  • 4
  • 11
1

I solved the same problem on a Ubuntu 10.04 server this way:

$ export LANGUAGE=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
$ sudo locale-gen en_US.UTF-8
$ sudo dpkg-reconfigure locales

To make the changes permanent you need to add there variable into /etc/environment

$ sudo vi /etc/environment
pulser1983
  • 15
  • 5
  • It would be better to set the locale variables (`LANGUAGE`, `LANG`, & `LC_ALL`) in you local profile or shell .rc file -- while in *your* environment everyone might be in the same location, speaking the same language, etc. sometimes you have to coexist on a server with people from all over the world. That's why you can set things like this with environment variables :-) – voretaq7 Nov 11 '12 at 02:12
0

LC_TIME = "custom.UTF-8"

This one looks quite odd, it should be "en_US.UTF-8", not "custom.UTF-8" You should grep /etc to see where it comes from.

Alex
  • 7,789
  • 4
  • 36
  • 51