Wednesday, 19 August 2009

locale configuration issue on Ubuntu 9.04


I've rent a new server by dedibox.fr and the ubuntu server version is tunned by the dedibox team...



On the Ubuntu Server 9.04 64bit/english version, there's a locale configuration issue.
whenever you do a aptitude update or run the 'locale' command you get a warning like this :

thomas@sd1:~$ 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_US.ISO-8859-15
LANGUAGE=en_US:en:en_GB:en
LC_CTYPE="en_US.ISO-8859-15"
LC_NUMERIC="en_US.ISO-8859-15"
LC_TIME="en_US.ISO-8859-15"
LC_COLLATE="en_US.ISO-8859-15"
LC_MONETARY="en_US.ISO-8859-15"
LC_MESSAGES="en_US.ISO-8859-15"
LC_PAPER="en_US.ISO-8859-15"
LC_NAME="en_US.ISO-8859-15"
LC_ADDRESS="en_US.ISO-8859-15"
LC_TELEPHONE="en_US.ISO-8859-15"
LC_MEASUREMENT="en_US.ISO-8859-15"
LC_IDENTIFICATION="en_US.ISO-8859-15"
LC_ALL=


or

thomas@sd1:~$ sudo  dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en:en_GB:en",
LC_ALL = (unset),
LANG = "en_US.ISO-8859-15"
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
Generating locales...
en_AU.UTF-8... up-to-date
en_BW.UTF-8... up-to-date
en_CA.UTF-8... up-to-date
en_DK.UTF-8... up-to-date
en_GB.UTF-8... up-to-date
en_HK.UTF-8... up-to-date
en_IE.UTF-8... up-to-date
en_IN.UTF-8... up-to-date
en_NG.UTF-8... up-to-date
en_NZ.UTF-8... up-to-date
en_PH.UTF-8... up-to-date
en_SG.UTF-8... up-to-date
en_US.ISO-8859-1... up-to-date
en_US.UTF-8... up-to-date
en_ZA.UTF-8... up-to-date
en_ZW.UTF-8... up-to-date
Generation complete.



I've asked the support for help, and I get a refusal arguing that software is not part of the support... but as you can install only a few Operating System provided by dedibox, which operating system has been tunned/preconfigured for their servers, I feel that they are responsible for it, if it doesn't works out of the box. (of course when you're installing new software or start editing the configuration, it's your responsibility).

Anyway, with dedibox, the support is so lame, takes so much time to answer your call (10 days to get a KVM over IP on a production system which was blocked at boot time), to finally not solve your issue

One can say that there is NO support by dedibox at all... One would be absolutely right!

So, build a redundant architecture if you decide to play with dedibox servers.

Anyway....


What is wrong here is that the current locale configured on the system (en_US.ISO-8859-15) does not exists on the system (see the one generated, you have en_US.ISO-8859-1 but not en_US.ISO-8859-15).

So to change the current locale of the system do this :

vi /etc/default/locale

and change it to this (en_US.UTF-8 is listed while regenerating the locales, so it should be good)

to :

LANGUAGE="en_US:en:en_GB:en"
LANG="en_US.UTF-8"

and then

vi /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
LANGUAGE="en_US:en:en_GB:en"
LANG="en_US.UTF-8"

then run this command :

thomas@sd1:~$ sudo  dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en:en_GB:en",
LC_ALL = (unset),
LANG = "en_US.ISO-8859-15"
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
Generating locales...
en_AU.UTF-8... up-to-date
en_BW.UTF-8... up-to-date
en_CA.UTF-8... up-to-date
en_DK.UTF-8... up-to-date
en_GB.UTF-8... up-to-date
en_HK.UTF-8... up-to-date
en_IE.UTF-8... up-to-date
en_IN.UTF-8... up-to-date
en_NG.UTF-8... up-to-date
en_NZ.UTF-8... up-to-date
en_PH.UTF-8... up-to-date
en_SG.UTF-8... up-to-date
en_US.ISO-8859-1... up-to-date
en_US.UTF-8... up-to-date
en_ZA.UTF-8... up-to-date
en_ZW.UTF-8... up-to-date
Generation complete.

You still have the warning which is normal since at the execution, the system is still ill-configured.
In order to complete the reconfiguration, you must to reboot !

after reboot, type

thomas@sd1:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en:en_GB: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=

the current locale is set to en_US.UTF-8 and there is no more warning.

Note : to add a particular charset you can use the following command :

locale-gen en_US.UTF-8 en_GB.UTF-8


You might also find localepurge usefull to cleanup unused locale :
aptitude install localepurge

5 comments:

Boris said...

Got the same problem, thanks tom for the tips and solution sharing.

Janaka Vishwajith said...

I got some issues on UTF-8. I needed to do fetch some sinhala fonts from database and it gives some unexpcted characters.
I could corrected it using ISO-8859-1.

:)

A said...

Doing the foll. also solves it:

>sudo aptitude install language-pack-en
>locale -a

Nikola said...

I've had this problem whole week, I tried almost every page google showed me, until I saw this. This should be the first suggestion they show, because it fixes the god damn problem :D Thank you!!! :)

Cabassut Frédéric said...

still working in 2015 with a ubuntu 14.04lts, thanks :)