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