How to upgrade postgresql from V13 to V14 or V15

Nextcloud version (eg, 20.0.5): 25.0.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.5 LTS
Apache or nginx version (eg, Apache 2.4.25): nginx 1.23.2
PHP version (eg, 7.4): 131.9

Issue :

Hello,
I am running Nextcloud on container using the following ansible script :
https://github.com/spantaleev/nextcloud-docker-ansible-deploy

It runs the following containers :
Traefik
nginx
nextcloud
postgres

Here my issue is with postgres. I m running postgres 13, and try to follow all upgrade of nextcloud and postgres.

This time, I would like to upgrade from postgres 13 to postgres 15

But it seems the password encryption changed from V13 to V14(and V15)

It went from md5 to SCRAM.

So when I update from postgres v13 to v15, I get the “Internal Server error” on my browser.
and in syslog I get the following error message :

Dec 18 17:32:00 Nuage nextcloud-postgres\[3123447\]: 2022-12-18 16:32:00.114 UTC \[43\] FATAL:  password authentication failed for user "oc\_feydreva"
Dec 18 17:32:00 Nuage nextcloud-postgres\[3123447\]: 2022-12-18 16:32:00.114 UTC \[43\] DETAIL:  User "oc\_feydreva" does not have a valid SCRAM secret.

Is this the first time you’ve seen this error? (Y/N): Each time I tryu to upgrade from pgsql v13 to v15

Steps to replicate it:

  1. upgrade pgsql to v15

There is no log to show, since nextcloud doesn’t start at all.

As anybody been able to upgrade its db from v13 to v14 and v15 ?

thank you !

AFAIK there is no “upgrade” for Postgres - you need to dump/backup and restore into new version. Usually if there is braking change you will find upgrade procedures in the release notes of specific software version.

As this question is related to Postgres I think it better to ask this question at Postgres forum - likely you get better answers there.

Starting V14, password encryption is SCRAM instead of md5… that s why I get a SCRAM error.
I can change the pg_hba.conf from
host all all all scram-sha-256
to
host all all all md5
and get password working, but after that i get an aother error :

sudo docker exec -it nextcloud-apache php occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Updating database schema
Exception: Database error when running migration 25000Date20220602190540 for app core
An exception occurred while executing a query: SQLSTATE[42501]: Insufficient privilege: 7 ERROR: permission denied for schema public
Update failed
Maintenance mode is kept active

I wonder if anybody has that issue.

as fas as i remember this is a “no go” to update nextcloud in a container.

that said, how did you update your postgres container? did you follow something like that: How to Upgrade PostgreSQL in Docker and Kubernetes - CloudyTuts

1 Like