Postgresql upgrade error with locale on rebuild


I’m currently trying to rebuild my container, which desperately fails:

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

The first time, I got this message:

les valeurs de lc_collate de la base de données « postgres » ne correspondent pas : ancien « en_US.UTF-8 », nouveau « fr_FR.UTF-8 »

Échec, sortie



You are going to need to export your data and import into a clean instance:

In containers/app.yml: Change "templates/postgres.template.yml" TO "templates/postgres.9.5.template.yml"

Run ./launcher rebuild app again

When your instance is running:

Run ./launcher enter app

Run apt-get remove postgresql-client-9.5

Run cd /shared/postgres_backup && sudo -u postgres pg_dump discourse > backup.db

Undo the base_image in your container config

Run: ./launcher stop app

Run: sudo mv /var/discourse/shared/standalone/postgres_data /var/discourse/shared/standalone/postgres_data_old

Run: ./launcher rebuild app

Run: ./launcher enter app

Run: cd /shared/postgres_backup

Run: sv stop unicorn

Run: sudo -iu postgres dropdb discourse

Run: sudo -iu postgres createdb discourse

Run: sudo -iu postgres psql discourse < backup.db

Run: exit

Run: ./launcher rebuild app

I’m trying to follow the instructions but it keeps failing, apparently due to the previous locale error.
I did locale-gen the correct locales.

Help anyone?


have you tried sudo dpkg-reconfigure locales

Yes, and I set the default locale to en_US.UTF-8.

λ  vincent@zbeul /var/discourse/ master echo $LANG
λ  vincent@zbeul /var/discourse/ master sudo echo $LANG

And yet…

The problem with postgresql seems unrelated to locales to me. Can you please give it a shot once again?

Here is the resulting log for a rebuild:

with the postgres.9.5 template in app.yml.

I don’t understand why is it falling back to C. are you sure dpkg reconfigure shown you the correct locales? (space is select, tab is toggle and enter is OK)
Word of caution, It may totally not be related to locales, I’d wait for someone from team to comment.

Yes, I’m absolutely sure. Thanks for your replies.

The real error seems to lie along these lines:

Finding the real data directory for the source cluster
could not get data directory using "/usr/lib/postgresql//bin/postgres" -D "/shared/postgres_data" -C data_directory: No such file or directory
Failure, exiting
1 Like

OK – back online.

I managed to go through the postgresql update process. The locale had to be changed container-side.

1 Like