pg_basebackup: error: could not get write-ahead log end position from server

While I was taking physical backup from slave server for configuring HA, I got a strange error.

-bash-4.2$ pg_basebackup -R -h 10.10.12.13 -U replication_user -D /pgdata/data -S ha_290120211601 -C
pg_basebackup: error: could not get write-ahead log end position from server: ERROR:  could not open directory "./lost+found": Permission denied
pg_basebackup: removing contents of data directory "/pgdata/data"

I have all the permissions on the slave but it was due to permission issues at the primary server.

-rw-------  1 postgres postgres 26650 Jun 11  2020 postgresql.conf
drwx------ 11 postgres postgres  4096 Jun 13  2020 base
-rw-------  1 postgres postgres  4389 Jan 28 11:14 pg_hba.conf
drwx------  2 root     root      4096 Jan 28 18:32 lost+found
drwx------  2 postgres postgres  4096 Jan 29 14:03 pg_notify
-rw-------  1 postgres postgres    57 Jan 29 14:03 postmaster.pid

The lost+found has root ownership which was the issue. After changing the ownership at primary server side, it resolved the issue.

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s