default locales
Ryan Steele
ryans at aweber.com
Thu Nov 13 01:20:22 CET 2008
As a preface, I'm using 3.2.14 on Ubuntu Server.
I've got FAI install clients that install packages (for example,
postgresql-8.3) that are dependent on the default locale being set to
(in my case) en_US.UTF-8. So, naturally I made sure that my
/srv/fai/config/debconf/CLASSNAME had the following:
locales locales/default_environment_locale select en_US.UTF-8
locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
But I noticed that the clients didn't think that was the default locale;
SQL_ASCII encoding is a direct result of the default locale not being
set and falling back to 'C'. The evidence is pretty clear:
root at host[~]# chroot /target
host[~]# su - postgres -c "psql -l"
List of databases
Name | Owner | Encoding
--------------+-----------+-----------
postgres | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
After some further investigation after ctrl+c'ing to hold off on the
reboot, I noticed that if I didn't include the 'language-pack-en'
package in my client's package list, a 'locale -a' shows only:
C
POSIX
and the system would spew messages 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, FAI (task_debconf, in particular) really seemed to want to convince
me that everything was okay. There was nothing in the error.log, and
only this in the other logs:
# From fai.log
Calling task_debconf
Adding debconf data from /var/lib/fai/config/debconf/CLASSNAME
Reconfiguring package locales
# From debconf.log
info: Trying to set 'locales/default_environment_locale' [select] to
'en_US.UTF-8'
info: Loading answer for 'locales/default_environment_locale'
info: Trying to set 'locales/locales_to_be_generated' [multiselect] to
'en_US.UTF-8 UTF-8'
info: Loading answer for 'locales/locales_to_be_generated'
However, the results don't lie - the postgres-8.3 package thinks that
the locale is C (or at least was at the time postgres was installed).
So what gives? Well, I think (not 100% sure, but definitely pretty
suspicious) the reason is that minimal Ubuntu Server installs don't do
any localization, and only natively have the C and POSIX locales, which
is maybe only a nuisance in some cases, but obviously a big problem for
packages like postgresql. So, I suppose my only recourse here is to
configure the locales in a hook before the package installation. The
instsoft.CLASSNAME hook seems like it would be a good candidate, though
I haven't tested it yet (but will report back once I have).
But even if it does, I really think that FAI should check to make sure
the client really has the debconf information we're told we can set in
the $FAI_CONFIGDIR/debconf/ directory. Based on the log entries (or
lack thereof), I initially assumed nothing went wrong when setting up
the client's locales, which is not the case, and wasted time looking
elsewhere for problems.
More information about the linux-fai
mailing list