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

3

39

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.

Ioyal answered 22/4, 2014 at 10:19 Comment(0)
N
92

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 ...
Nescience answered 22/4, 2014 at 10:57 Comment(0)
W
0

#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

Westbrooke answered 22/6, 2022 at 9:5 Comment(1)
Format your answer with proper code blockRicks
S
0

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

Slog answered 26/4, 2023 at 5:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.