1

I have CentOs 6.7 installed on my server:

bash-4.1# uname -r
2.6.32-573.18.1.el6.x86_64

After server restart, my PostgreSQL 9.6 server is not starting due to locale issue.

Here is the log error message: pgstartup.log

< 2017-01-26 16:33:08.115 IST > LOG:  invalid value for parameter "lc_messages": "en_US.UTF-8"
< 2017-01-26 16:33:08.123 IST > LOG:  invalid value for parameter "lc_monetary": "en_US.UTF-8"
< 2017-01-26 16:33:08.123 IST > LOG:  invalid value for parameter "lc_numeric": "en_US.UTF-8"
< 2017-01-26 16:33:08.123 IST > LOG:  invalid value for parameter "lc_time": "en_US.UTF-8"
< 2017-01-26 16:33:08.123 IST > FATAL:  configuration file "/var/lib/pgsql/9.6/data/postgresql.conf" contains errors

It is expecting locale "en_US.UTF-8" to be available in the system. I have checked and it is indeed available.

bash-4.1# locale -a | grep en_US
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_COLLATE to default locale: No such file or directory
en_US
en_US.UTF-8
en_US.iso88591
en_US.iso885915
en_US.utf8

So, I commented the following lines from the postgresql.conf file:

#lc_messages = 'en_US.UTF-8'                    # locale for system error message
                                        # strings
#lc_monetary = 'en_US.UTF-8'                    # locale for monetary formatting
#lc_numeric = 'en_US.UTF-8'                     # locale for number formatting
#lc_time = 'en_US.UTF-8'                                # locale for time formatting

After commenting lines as per above, the server is getting stared, but can not login to the server, and crying the following error:

bash-4.1$ psql
psql: FATAL:  database locale is incompatible with operating system
DETAIL:  The database was initialized with LC_COLLATE "en_US.UTF-8",  which is not recognized by setlocale().
HINT:  Recreate the database with another locale or install the missing locale.

Now I have the locale in the system which is required by postgres, then also its crying.Don't know where exactly the issue is.

Note: This issue generate after server reboot.

1 Answers1

1

I have found the solution to this problem.

Actually, locales are provided by Glibc library. In the server, Glibc version was 2.12.

For some reason, we needed 2.14 version and it was not possible to upgrade 2.12 to 2.14 via yum, as yum was saying its latest version.

So we manually compiled 2.14 source and created binaries.

and changed the link of 2.12 to 2.14 and created this mess.

Solution: reverted back the sym link to original 2.12 version.

Moral: Never mess up with glibc, not this way by pointing sym links to different versions.