pg_upgrade fails with errors upgrading from PostgreSQL 14 to 15

1.1k views Asked by At

I'm trying to upgrade from postgre 14 to 15 following the Arch Linux wiki (https://wiki.archlinux.org/title/PostgreSQL#Upgrading_PostgreSQL).

When I try to run pg_upgrade -b /opt/pgsql-14/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data, I get 3 errors.

The first says: *failure* Consult the last few lines of "/var/lib/postgres/data/pg_upgrade_output.d/20230316T060518.312/log/pg_upgrade_server.log" for the probable cause of the failure.

Upon looking at that file with nano /var/lib/postgres/data/pg_upgrade_output.d/20230316T043157.132/log/pg_upgrade_server.log

I get

waiting for server to start....2023-03-16 04:31:57.238 CDT [152331] FATAL:  data directory "/var/lib/postgres/olddata" has invalid per>
2023-03-16 04:31:57.238 CDT [152331] DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
 stopped waiting
pg_ctl: could not start server
Examine the log output.

I tried changing the permissions of the folder /var/lib/postgres/olddata with the command sudo chmod 0700 /var/lib/postgres/olddata but I keep getting the same error.

This is the full error:

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok

*failure*
Consult the last few lines of "/var/lib/postgres/data/pg_upgrade_output.d/20230316T060518.312/log/pg_upgrade_server.log" for
the probable cause of the failure.

connection to server on socket "/var/lib/postgres/tmp/.s.PGSQL.50432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

could not connect to source postmaster started with the command:
"/opt/pgsql-14/bin/pg_ctl" -w -l "/var/lib/postgres/data/pg_upgrade_output.d/20230316T060518.312/log/pg_upgrade_server.log" -D "/var/lib/postgres/olddata" -o "-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/postgres/tmp'" start
Failure, exiting
0

There are 0 answers