Reputation: 21
i am getting permission denied error while taking backup using pg_basebackup.
/usr/pgsql-11/bin/pg_basebackup -h127.0.0.1 -U thbbackup -D backup -Ft -z -P
Password:
238546/238575 kB (99%), 1/1 tablespace
pg_basebackup: could not get write-ahead log end position from server: ERROR: could not open file "./.postgresql.conf.swp": Permission denied
pg_basebackup: removing data directory "backup"
Upvotes: 1
Views: 3196
Reputation: 1
In this case it looks like a swap file from an open editor or previously orphaned. In general, Postgres needs ownership of all files in the data directory for a pg_basebackup. I have seen this failure on files with root:root
or other ownership residing in the data directory. After running chown postgres:postgres [filename]
on the target files, pg_basebackup should be able to run successfully.
Upvotes: 0
Reputation: 37
You have probably forgotten the file postgresql.conf open in a text editor (vim). If you open this conf file again then the text editor should complain saying it is already open so, you can just delete this as .swp file it is a temporary file anyway.
"When you edit a file in Vim, you have probably noticed the (temporary) .swp file that gets created. By default it'll be in the same location as the file that you are editing (although you can change this). The swap file contains the info about changes made to the file (or buffer)."
Upvotes: 2