You are not logged in.

#1 2025-01-17 16:31:55

Epp
Member
Registered: 2022-07-11
Posts: 83

[SOLVED] Postgresql upgrade

Hi,

I read the news that I had to upgrade my machine due to security reasons for rsync.
So, with speed I went to my machine and upgraded.
It's not an excuse, but after the -Syu, postgresql crashed. And no, I did not make a backup before this upgrade.
I did copy the files before running the pg_upgrade steps from the wiki.
In the wiki I read for postgresql: Warning: See #Upgrading PostgreSQL for necessary steps before upgrading to new versions of the PostgreSQL packages.
That was sadly a bit too late.

If I remember correct (from yesterday), the service could not run because "The database is older than.."

So I followed the steps at pg_upgrade.
And almost made it to the end (I think) but most likely something went wrong along the way.

I can not run the command from step 7:

[postgres]$ pg_upgrade -b /opt/pgsql-PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data

A few things are weird I think. After running the steps above there is nothing in that opt folder where the old executable should be.
And I think that this is an outdated line (hence the mentioning of the version in the path).

Perhaps I came close to a solution with the command from step 7, but with the same folder for old and the new executable. Yeah, it probably does not make any sense.

[postgres@oops tmp]$ pg_upgrade -b /usr/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data

Output was:

Performing Consistency Checks
-----------------------------
Checking cluster versions
Old cluster data and binary directories are from different major versions.
Failure, exiting

Advice is more than welcome!

Last edited by Epp (2025-01-18 08:40:54)

Offline

#2 2025-01-17 19:46:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,901

Re: [SOLVED] Postgresql upgrade

Did you just copy paste commands/went straight to the step by step without reading the prelude? the stuff in opt is provided by https://archlinux.org/packages/?name=po … ld-upgrade which is talked about in the beginning of the https://wiki.archlinux.org/title/PostgreSQL#pg_upgrade section

and PG-VERSION is a generic placeholder, you have to replace it with the actual version you upgraded from, i.e. /opt/pgsql-16/bin

Last edited by V1del (2025-01-17 19:49:32)

Offline

#3 2025-01-18 07:57:54

Epp
Member
Registered: 2022-07-11
Posts: 83

Re: [SOLVED] Postgresql upgrade

V1del wrote:

Did you just copy paste commands/went straight to the step by step without reading the prelude? the stuff in opt is provided by https://archlinux.org/packages/?name=po … ld-upgrade which is talked about in the beginning of the https://wiki.archlinux.org/title/PostgreSQL#pg_upgrade section

and PG-VERSION is a generic placeholder, you have to replace it with the actual version you upgraded from, i.e. /opt/pgsql-16/bin

Yes, that, but I think my unconsciousness did not want to read that I had to install a second (old) version to make the upgrade possible.
But now it makes more sense (the old-upgrade package brings de folder with the version number).

Thanks a lot for making it clear and thanks a lot to the wiki page writer for all the detailed info!

Offline

Board footer

Powered by FluxBB