pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_basebackup Error could not open directory
4+ messages / 3 participants
[nested] [flat]

* pg_basebackup Error could not open directory
@ 2015-10-24 01:56  Ankur Kaushik <ankurkaushik@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Ankur Kaushik @ 2015-10-24 01:56 UTC (permalink / raw)
  To: pgsql-admin

User created as CREATE ROLE base_backup_user REPLICATION LOGIN PASSWORD
'backupuser';


-bash-4.1$ pg_basebackup -h 127.0.0.1 -U base_backup_user -D "./pgbackup"
-Ft -z -P
pg_basebackup: could not get backup header: ERROR:  could not open
directory "./backup": Permission denied


Getting Below error while using pg_basebackup

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_basebackup Error could not open directory
@ 2015-10-24 03:04  John Scalia <jayknowsunix@gmail.com>
  parent: Ankur Kaushik <ankurkaushik@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: John Scalia @ 2015-10-24 03:04 UTC (permalink / raw)
  To: Ankur Kaushik <ankurkaushik@gmail.com>; pgsql-admin

Ankur,

This should be really easy to solve:

1) Who owns this backup directory
2) what is the mode of that directory, i.e., 555, 755, or what?

You could simply try "chmod 777 ./backup" and then reattempt your pg_basebackup command.
--
Jay

On 10/23/2015 8:56 PM, Ankur Kaushik wrote:
>
> User created as CREATE ROLE base_backup_user REPLICATION LOGIN PASSWORD 'backupuser';
>
>
> -bash-4.1$ pg_basebackup -h 127.0.0.1 -U base_backup_user -D "./pgbackup" -Ft -z -P
> pg_basebackup: could not get backup header: ERROR:  could not open directory "./backup": Permission denied
>
>
> Getting Below error while using pg_basebackup



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_basebackup Error could not open directory
@ 2015-10-24 04:57  Ankur Kaushik <ankurkaushik@gmail.com>
  parent: John Scalia <jayknowsunix@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Ankur Kaushik @ 2015-10-24 04:57 UTC (permalink / raw)
  To: John Scalia <jayknowsunix@gmail.com>; +Cc: pgsql-admin

I was looking the actual cause of this error as already given the
permission to /tmp/backup

permission to /tmp/backup

drwx------  4 postgres postgres 4.0K Oct 24 10:10 backup

still giving error

As given below error
==================

pg_basebackup -P -v -D /tmp/backup/new1 -x -Ft -z -U base_backup_user -h
127.0.0.1
Password:
transaction log start point: 0/DF000060 on timeline 1
pg_basebackup: could not get backup header: ERROR:  could not open
directory "./backup": Permission denied

===============

In the next step I found one more backup directory in location
"/var/lib/pgsql/9.4/data" check its permission

drwx------  2 root     root     4.0K Oct 24 05:01 backup

 changed the permission as in location /va/lib/pgsql/9.4/data

chown -R postgres:postgres backup/

pg_basebackup works fine

Its strange to me   I am taking backup in location "/tmp/backup/new1"  but
I have to check the permission of "/var/lib/pgsql/9.4/data/backup"

I am mysql guy and new to postgresql may be missed some basics of
postgresql



On Sat, Oct 24, 2015 at 8:34 AM, John Scalia <jayknowsunix@gmail.com> wrote:

> Ankur,
>
> This should be really easy to solve:
>
> 1) Who owns this backup directory
> 2) what is the mode of that directory, i.e., 555, 755, or what?
>
> You could simply try "chmod 777 ./backup" and then reattempt your
> pg_basebackup command.
> --
> Jay
>
> On 10/23/2015 8:56 PM, Ankur Kaushik wrote:
> >
> > User created as CREATE ROLE base_backup_user REPLICATION LOGIN PASSWORD
> 'backupuser';
> >
> >
> > -bash-4.1$ pg_basebackup -h 127.0.0.1 -U base_backup_user -D
> "./pgbackup" -Ft -z -P
> > pg_basebackup: could not get backup header: ERROR:  could not open
> directory "./backup": Permission denied
> >
> >
> > Getting Below error while using pg_basebackup
>
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_basebackup Error could not open directory
@ 2015-10-24 11:51  Magnus Hagander <magnus@hagander.net>
  parent: Ankur Kaushik <ankurkaushik@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Magnus Hagander @ 2015-10-24 11:51 UTC (permalink / raw)
  To: Ankur Kaushik <ankurkaushik@gmail.com>; +Cc: John Scalia <jayknowsunix@gmail.com>; pgsql-admin

This indicates that someone has created a directory called "backup" inside
your data directory (/var/lib/pgsql/9.4/data), without postgres having
permissions on it.

My guess is at some point you accidentally ran pg_basebackup telling it to
store the backup in that directory, and ran it as user root, which created
a directory there.

There should be no directory named "backup" inside the data directory, so
once you've verified it's not something else that ended up there by
mistake, you should just remove it. Basically you should *never* create any
files or directories manually inside the data directory.

//Magnus

On Sat, Oct 24, 2015 at 6:57 AM, Ankur Kaushik <ankurkaushik@gmail.com>
wrote:

>
> I was looking the actual cause of this error as already given the
> permission to /tmp/backup
>
> permission to /tmp/backup
>
> drwx------  4 postgres postgres 4.0K Oct 24 10:10 backup
>
> still giving error
>
> As given below error
> ==================
>
> pg_basebackup -P -v -D /tmp/backup/new1 -x -Ft -z -U base_backup_user -h
> 127.0.0.1
> Password:
> transaction log start point: 0/DF000060 on timeline 1
> pg_basebackup: could not get backup header: ERROR:  could not open
> directory "./backup": Permission denied
>
> ===============
>
> In the next step I found one more backup directory in location
> "/var/lib/pgsql/9.4/data" check its permission
>
> drwx------  2 root     root     4.0K Oct 24 05:01 backup
>
>  changed the permission as in location /va/lib/pgsql/9.4/data
>
> chown -R postgres:postgres backup/
>
> pg_basebackup works fine
>
> Its strange to me   I am taking backup in location "/tmp/backup/new1"  but
> I have to check the permission of "/var/lib/pgsql/9.4/data/backup"
>
> I am mysql guy and new to postgresql may be missed some basics of
> postgresql
>
>
>
> On Sat, Oct 24, 2015 at 8:34 AM, John Scalia <jayknowsunix@gmail.com>
> wrote:
>
>> Ankur,
>>
>> This should be really easy to solve:
>>
>> 1) Who owns this backup directory
>> 2) what is the mode of that directory, i.e., 555, 755, or what?
>>
>> You could simply try "chmod 777 ./backup" and then reattempt your
>> pg_basebackup command.
>> --
>> Jay
>>
>> On 10/23/2015 8:56 PM, Ankur Kaushik wrote:
>> >
>> > User created as CREATE ROLE base_backup_user REPLICATION LOGIN PASSWORD
>> 'backupuser';
>> >
>> >
>> > -bash-4.1$ pg_basebackup -h 127.0.0.1 -U base_backup_user -D
>> "./pgbackup" -Ft -z -P
>> > pg_basebackup: could not get backup header: ERROR:  could not open
>> directory "./backup": Permission denied
>> >
>> >
>> > Getting Below error while using pg_basebackup
>>
>>
>


-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2015-10-24 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-10-24 01:56 pg_basebackup Error could not open directory Ankur Kaushik <ankurkaushik@gmail.com>
2015-10-24 03:04 ` John Scalia <jayknowsunix@gmail.com>
2015-10-24 04:57   ` Ankur Kaushik <ankurkaushik@gmail.com>
2015-10-24 11:51     ` Magnus Hagander <magnus@hagander.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox