1

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
  • The second error seem like a result of the first one. The server could not start up and therefore the script can not connect to it. – SebDieBln Mar 16 '23 at 13:41
  • What are the permissions of the `/var/lib/postgres/olddata` directory? Before and after you run `chmod`? – SebDieBln Mar 16 '23 at 13:42
  • Kindly show us the complete error message and tell us what user you were when you ran `pg_upgrade`. What does an `ls -ld` on the data directory show? – Laurenz Albe Mar 16 '23 at 18:12
  • @SedDieBin The permissions before and after I run `chmod` are `drwx------ 20 postgres postgres`. – user2023630 Mar 17 '23 at 05:56
  • @Laurenz Albe I have updated my question with the full error message. – user2023630 Mar 17 '23 at 09:49
  • Thanks, but the important error message would have been the one in your first code block. Your cut off the relevant message in the middle. Also, my comment asked for more information than that. – Laurenz Albe Mar 20 '23 at 02:41
  • @LaurenzAlbe `ls -ld` on `/var/lib/postgres/data` returns `drwx------ 19 postgres postgres 4096 Mar 20 07:12 /var/lib/postgres/data` – user2023630 Mar 22 '23 at 03:20
  • Well, to draw it out piece by piece, were you user `postgres` when you ran `pg_upgrade`? – Laurenz Albe Mar 22 '23 at 05:16

0 Answers0