centos 6で新しいロケールを作成する

centos 6で新しいロケールを作成する

昨夜停電が発生し、システムがシャットダウンしました。

午前中にシステムの電源を入れたときにPostgreSQLデータベースサーバーが起動しませんでした。

pgstartup.logファイルの表示中に次の行が見つかりました。

< 2017-01-23 15:26:17.577 IST >DETAIL:  The database was initialized with LC_COLLATE "en_US.UTF-8",  which is not recognized by setlocale().
< 2017-01-23 15:26:17.577 IST >HINT:  Recreate the database with another locale or install the missing locale.

明らかに、PostgreSQL(en_US.UTF-8)に必要なロケールはシ​​ステムで使用できません。

また、localeコマンドを実行してクロス検証を実行しましたが、これは出力です。

$ 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.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=

インターネットでの検索中に、次のコマンドを使用して欠落ロケールを生成できることがわかりました。

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

ただし、コマンドを実行すると、次のエラーで失敗します。

$ sudo localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
[sudo] password for anil:
/usr/share/i18n/locales/en_US:7: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:8: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:9: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:11: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:14: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:15: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:16: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:17: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:19: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:20: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:21: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:22: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:23: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:24: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:25: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:26: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:27: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:28: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:29: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:34: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:50: non-symbolic character value should not be used
/usr/share/i18n/locales/i18n:1425: non-symbolic character value should not be used
/usr/share/i18n/locales/i18n:1674: non-symbolic character value should not be used
/usr/share/i18n/locales/i18n:1719: non-symbolic character value should not be used
/usr/share/i18n/locales/i18n:1756: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:53: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:59: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:152: non-symbolic character value should not be used
/usr/share/i18n/locales/en_US:40: non-symbolic character value should not be used
/usr/share/i18n/locales/iso14651_t1:3: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:10: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:11: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:12: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:13: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:14: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:15: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:16: non-symbolic character value should not be used
/usr/share/i18n/locales/translit_neutral:17: non-symbolic character value should not be used
LC_NAME: field `name_gen' not defined
LC_IDENTIFICATION: field `audience' not defined
LC_IDENTIFICATION: field `application' not defined
LC_IDENTIFICATION: field `abbreviation' not defined
LC_IDENTIFICATION: no identification for category `LC_MEASUREMENT'
LC_CTYPE: table for class "upper": 1756 bytes
LC_CTYPE: table for class "lower": 1756 bytes
LC_CTYPE: table for class "alpha": 4320 bytes
LC_CTYPE: table for class "digit": 600 bytes
LC_CTYPE: table for class "xdigit": 600 bytes
LC_CTYPE: table for class "space": 856 bytes
LC_CTYPE: table for class "print": 5976 bytes
LC_CTYPE: table for class "graph": 5976 bytes
LC_CTYPE: table for class "blank": 856 bytes
LC_CTYPE: table for class "cntrl": 664 bytes
LC_CTYPE: table for class "punct": 4824 bytes
LC_CTYPE: table for class "alnum": 4320 bytes
LC_CTYPE: table for class "combining": 3152 bytes
LC_CTYPE: table for class "combining_level3": 2832 bytes
LC_CTYPE: table for map "toupper": 16924 bytes
LC_CTYPE: table for map "tolower": 15388 bytes
LC_CTYPE: table for map "totitle": 16924 bytes
LC_CTYPE: table for width: 26712 bytes
$

これまで、このエラーの解決策が見つかりませんでした。

環境の詳細:

$ uname -r
2.6.32-573.18.1.el6.x86_64

すべてのen_USロケール:

$ 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.iso88591
en_US.iso885915
en_US.utf8

ベストアンサー1

次のコマンドで間違いを犯したことを発見しました。


無効なコマンド:

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

正しいコマンド:

localedef -v -c -i en_US -f utf8 en_US.UTF-8

おすすめ記事