3

duplicate of unanswered question:

CentOS 7 pg_upgrade Permissions Errors

when trying to run pg_upgrade, it won't let me run the command as root. when exiting from root, it can't access files due to permissions. how can this be solved?

command i'm running:

/usr/pgsql-12/bin/pg_upgrade --old-bindir=/usr/pgsql-10/bin/ --new-bindir=/usr/pgsql-12/bin/ --old-datadir=/var/lib/pgsql/10/data/ --new-datadir=/var/lib/pgsql/12/data/

error message when running command as root:

pg_upgrade: cannot be run as root
Failure, exiting

error message when not running command as root:

could not open version file: /var/lib/pgsql/10/data/PG_VERSION
Failure, exiting

also tried to run command as postgres user

su postgres

/usr/pgsql-12/bin/pg_upgrade --old-bindir=/usr/pgsql-10/bin/ --new-bindir=/usr/pgsql-12/bin/ --old-datadir=/var/lib/pgsql/10/data/ --new-datadir=/var/lib/pgsql/12/data

could not change directory to "/home/j.d": Permission denied

could not open log file "pg_upgrade_internal.log": Permission denied
Failure, exiting
Jelly Wu
  • 281
  • 1
  • 3
  • 10
  • Could you please provide details of your specific problem? i.e., are your version and paths the same as that other post? If not, then we need to see what your specific environment looks like – richyen Oct 29 '19 at 17:47
  • I have answered the other question. That should help you. – Laurenz Albe Oct 29 '19 at 17:56
  • so i have tried that but it gives an error as well, i'll add it to the post – Jelly Wu Oct 29 '19 at 17:59
  • I think part of the problem is that when you ran `pg_upgrade` as root and as the other user, the files got created with those users' ownership (i.e., `pg_upgrade_internal.log). Now, you run `pg_upgrade` as `postgres`, and it can't access those files because they're owned by `root` and/or `j.d`. Try clearing out those files before running `pg_upgrade` again – richyen Oct 29 '19 at 18:46
  • i am facing same issue –  Jul 23 '21 at 09:11

0 Answers0