Upgrade from postgres 13 to 15 failing - currently means forum is unavailable

Hi all,

I am getting the below error when trying to run a rebuild to upgrade to most recent test-passed. This would include bumping the postgres version from 13 to 15.

[2025-03-12T20:49:22.045226 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/15/main/pg_hba.conf
I, [2025-03-12T20:49:22.045431 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-03-12T20:49:22.045624 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-03-12T20:49:22.045816 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
debconf: delaying package configuration, since apt-utils is not installed
cp: cannot stat '/etc/postgresql/13/main/*': No such file or directory

The script just becomes stuck at this copy command.

When I try to restart the forum, restart command completes successfully but the forum is showing “connection refused”.

How do I either rollback to use my backup in postgres 13 or move forward? Thanks

Until smarter folks show up to help go to this topic about the postgres upgrade

4 Likes

You could just create a completely new server and import the back up.

1 Like

I want to avoid this if possible

2 Likes

It’s the easiest solution.

Restart the old container. You’ll have your forum. You can get the new server working at your leisure.

The restart container could not run because it was in an intermittent state between database versions. I have deleted the postgres_data folder and now am restoring from backup

What are your server specs? If using Ubuntu LTS what version is your server?

1 Like

Were you able to restore the site?

If you’re indeed running an older OS and Docker version, I recommend updating both before retrying the rebuild.

Were you perhaps updating a large database? If so, it’s possible that the update was still running. During the rebuild, you can periodically compare the size of the postgres_data and postgres_data_new directories. If the size of postgres_data_new keeps growing, the update is still ongoing. (You can also confirm whether the pg_upgrade command is running from the process list.)


You may ignore that cp error for now. I was able to update a test site on a standard install even with the same error. (It was caused by an upstream change so we’ll fix the image to remove the error, but it should not break the database updates unless the postgres configs were significantly modified beforehand.)

5 Likes

Hi there,

yes I was able to restore the site. We were indeed updating a large database, but I was keeping an eye on the above directories to ensure postgres_data_new was growing. After a time it did not grow further, and the script just became stuck on this command

Our config was pretty standard, apart from the large size of the db. I’ll get the details together and will post these details later today.

1 Like