facebookarchive / CommunityCellularManager

Tool for deploying, managing and controlling your Community Cellular Networks
Other
87 stars 36 forks source link

Cloud: Postgres fails to initialize in DB VM when using non-en_US locale. #6

Closed iedemam closed 8 years ago

iedemam commented 8 years ago

On both Ubuntu 14.04 and 16.04, the DB VM fails to complete its "Add all the packages needed for operation" playbook task if the host locale is not set to en_US. In my case, Ubuntu had automagically set my locale to es_ES based on my timezone during installation. The error reported is:

Adding user postgres to group ssl-cert

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
 * No PostgreSQL clusters exist; see \"man pg_createcluster\"
Error: The locale requested by the environment is invalid.
Error: could not create default cluster. Please create it manually with

  pg_createcluster 9.3 main --start

or a similar command (see 'man pg_createcluster').

This is because remote sessions using non-en_US locales fail to set the LANGUAGE environment variable properly. An article referencing the problem can be found here: https://www.digitalocean.com/community/questions/language-problem-on-ubuntu-14-04

After setting my locale back to en_US in all aspects (date, time, numeric, etc), the LANGUAGE environment variable was set properly again and postgres installed successfully.

A fix would be to hardcode the locale environment variables into the playbook. If that is an acceptable solution, I will prepare a PR. A workaround is having a proper LANGUAGE variable defined in your .bash_profile.

Last tested on 3e9b52b082ad602fdcab5cc05643b022a7655f2f.

9muir commented 8 years ago

Thanks for reporting. I think hardcoding the env vars seems reasonable, I don't think we will need to support non-US locales in the BTS. If you can prepare a PR that would be great.

iedemam commented 8 years ago

Roger. Will do.

9muir commented 8 years ago

closed by #7