This is the first major problem I’ve ran into while maintaining two Discourse sites. The (currently) broken forum had two particularities but installation was done by the book. One of these special settings is Spanish locale, configured like this:
params:
db_default_text_search_config: "pg_catalog.spanish"
env:
LANG: es_ES.UTF-8
DISCOURSE_DEFAULT_LOCALE: es
This was running smoothly for a year or so, until I couldn’t do an automatic upgrade. Fine, I thought, let’s go manual. That’s when ./launcher rebuild app started complaining about missing locales:
2017-03-28 12:08:55 UTC [48-2] FATAL: database files are incompatible with server
2017-03-28 12:08:55 UTC [48-3] DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.5.5.
I did my homework and studied several reports of similar issues in this community. There’s too many posts to link to but, suffice to say, no suggested solution works. It would seem as if something else is going on here. First, I made the following change in my app.yml:
env:
LANG: en_US.UTF-8
DISCOURSE_DEFAULT_LOCALE: es
Which was a bit of progress. Here’s the relevant error:
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/9.5/man/man1/psql.1.gz because link group psql.1.gz is broken
update-alternatives: error: error creating symbolic link '/usr/share/man/man1/psql.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package postgresql-client-9.3 (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of postgresql-9.3:
postgresql-9.3 depends on postgresql-client-9.3; however:
Package postgresql-client-9.3 is not configured yet.
And the final recommendation to export a backup and start anew:
UPGRADE OF POSTGRES FAILED
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.3.template.yml"
Fine, I can live with that. So I made the suggested change:
templates:
- "templates/postgres.9.3.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/sshd.template.yml"
- "templates/web.ratelimited.template.yml"
And now I’m effectively stumped:
Removing postgresql-contrib-9.5 (9.5.5-1.pgdg16.04+1) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/9.5/man/man1/postmaster.1.gz because link group postmaster.1.gz is broken
update-alternatives: error: error creating symbolic link '/usr/share/man/man1/postmaster.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package postgresql-contrib-9.5 (--remove):
subprocess installed pre-removal script returned error exit status 2
dpkg: postgresql-9.5: dependency problems, but removing anyway as you requested:
postgresql-contrib-9.5 depends on postgresql-9.5 (= 9.5.5-1.pgdg16.04+1).
Removing postgresql-9.5 (9.5.5-1.pgdg16.04+1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Removing postgresql-client-9.5 (9.5.5-1.pgdg16.04+1) ...
Processing triggers for postgresql-common (178.pgdg16.04+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Errors were encountered while processing:
postgresql-contrib-9.5
This is as far I can go and I wanted to report this before I do anything that irreversibly breaks the database. I can’t export the backup because apparently Docker can’t get PostgreSQL running in the container (to my understanding).
Any help would be greatly appreciated. The second particularity in this install is that’s it’s multisite, although I’m running a simple HTML portal along with Discourse. I don’t believe it has anything to do with these errors, which seem to be due to unsupported locales in PSQL 9.5.
Thoughts? Ideas? Prayers?