Constantine M
Constantine M

Reputation: 1547

"cannot write to log file pg_upgrade_internal.log" when upgrading from Postgresql 9.1 to 9.3

I keep on getting the above error whenever I run the following command via a postgres user.

/usr/lib/postgresql/9.3/bin/pg_upgrade \
   -b /usr/lib/postgresql/9.1/bin/ \
   -B /usr/lib/postgresql/9.3/bin/ \
   -d /var/lib/postgresql/9.1/main \
   -D /var/lib/postgresql/9.3/main

cannot write to log file pg_upgrade_internal.log Failure, exiting

I'm using Ubuntu 13.10. Both Postgresql 9.1 and 9.3 are running properly.

Upvotes: 39

Views: 24868

Answers (3)

Sajad Abdollahi
Sajad Abdollahi

Reputation: 211

fix with chown: chown postgres:postgres /usr/lib/postgresql/9.3/bin

Upvotes: 0

user19389607
user19389607

Reputation: 1

#run pg_upgrade command in new data directory path.

Ex: bash-4.2$ pwd

/var/lib/pgsql/11/data

bash-4.2$ /usr/pgsql-11/bin/pg_upgrade --old-datadir=/var/lib/pgsql/10/data --new-datadir=/var/lib/pgsql/11/data --old-bindir=/usr/pgsql-11/bin --new-bindir=/usr/pgsql-11/bin -c

Upvotes: 0

Daniel Vérité
Daniel Vérité

Reputation: 61696

Make sure that you run this command from a directory that is writable by the postgres user, like /tmp or /var/lib/postgresql:

$ cd /tmp
$ usr/lib/postgresql/9.3/bin/pg_upgrade ...

Upvotes: 92

Related Questions