linuxpostgresqldatabase-migrationpg-upgrade

pg_upgrade oldbindir check fails


I'm trying to upgrade postgresql database from 9.1 to 9.4. I ran the 9.4 version of pg_upgrade as follows:

sudo -u postgres pg_upgrade -b <path>/postgres/9.1/bin -B <path>/postgres/9.4/bin -d <path>/9.1DBs/ -D <path>/<empty folder>

I get:

check failed for: <path>/postgres/9.1/bin Permission denied

The folder exists, I set the permissions to 777, even gave the postgres user ownership of the directory structure, but I'm still getting the same error.

Running in verbose mode does not provide any extra info. The partition with that contains the old binaries is mounted under /media/ and I have read/write access.

Any ideas what could be causing this?


Solution

  • This error

    check failed for: /postgres/9.1/bin Permission denied

    happens because access permission on directories (x bit) need to be set in every directory in the hierarchy, from the root to the directory containing these executables files.

    This is detailed at Unix.SE in:

    Do the parent directory's permissions matter when accessing a subdirectory?