Difference between revisions of "Locales inside VE"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(added a permanent fix for the missing locale problem)
(added error given by PostgreSQL in case of missing locales)
Line 11: Line 11:
 
     are supported and installed on your system.
 
     are supported and installed on your system.
 
  perl: warning: Falling back to the standard locale ("C")
 
  perl: warning: Falling back to the standard locale ("C")
 +
 +
Another common problem is with PostgreSQL, if it won't start up and you see something like this in your <pgsql_data_dir>/serverlog:
 +
 +
invalid value for parameter "lc_messages": "en_US.UTF-8"
  
 
== Resolution ==
 
== Resolution ==

Revision as of 17:18, 21 March 2008

Problem description

After creating a VE (e.g. using centos-4-i386-default template) running perl (any perl script), results in the warning message:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en",
        LC_ALL = (unset),
        LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C")

Another common problem is with PostgreSQL, if it won't start up and you see something like this in your <pgsql_data_dir>/serverlog:

invalid value for parameter "lc_messages": "en_US.UTF-8"

Resolution

Some of templates have removed locales inside, since locales take really much space (~20Mb) while not needed in most cases (except for the default "C" locale).

So in this example /usr/lib/locale/en_US/LC_TIME and other files are missing.

Fix 1

reinstall glibc-common package using the command:

# rpm -ihv --force glibc-common.rpm

Fix 2

Or disable overriding of LC_* variables in /etc/ssh/sshd_config:

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

to

#AcceptEnv LANG LC_*

so the default LC will be used.

Fix 3

To fix this permanently for all new vzs you create, edit your /vz/templates/<distro>/<version>/<platform>/.rpmmacros and change the line %_install_langs C to include the language(s) you want, for example:

%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8

or simply

%_install_langs all

After this you will need to rebuild your OS template cache, for example:

vzpkgcache -r centos-4-i386-vmirth
vzpkgcache centos-4-i386-vmirth