rsync: change_dir "/var/lib/postgresql/9.1/main" failed: Permission denied

2,624 views
Skip to first unread message

杨华杰

unread,
Apr 15, 2013, 6:31:47 AM4/15/13
to pgba...@googlegroups.com
Hi

I faced this error when I was following this http://docs.pgbarman.org/

Any ideas ?

Starting backup for server main in /var/lib/barman-1.2.0/main/base/20130415T182247
Backup start at xlog location: 0/2D000020 (00000001000000000000002D, 00000020)
2013-04-15 18:22:48,207 barman.backup INFO: Backup start at xlog location: 0/2D000020 (00000001000000000000002D, 00000020)
Copying files.
2013-04-15 18:22:48,207 barman.backup INFO: Copying files.
rsync: change_dir "/var/lib/postgresql/9.1/main" failed: Permission denied (13)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1536) [Receiver=3.0.9]
2013-04-15 18:22:48,868 barman.backup ERROR: ERROR: data transfer failure
None
2013-04-15 18:22:51,957 barman.backup ERROR: Backup failed copying files
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/barman-1.2.0-py2.7.egg/barman/backup.py", line 483, in backup
    backup_size = self.backup_copy(backup_info)
  File "/usr/local/lib/python2.7/dist-packages/barman-1.2.0-py2.7.egg/barman/backup.py", line 854, in backup_copy
    raise Exception(msg)
Exception: ERROR: data transfer failure

Gabriele Bartolini

unread,
Apr 15, 2013, 6:36:39 AM4/15/13
to pgba...@googlegroups.com, 杨华杰
Hi,

Il 15/04/13 12:31, 杨华杰 ha scritto:
> rsync: change_dir "/var/lib/postgresql/9.1/main" failed: Permission
> denied (13)
it seems like the user you are connecting with on the Postgres server
from barman's cannot access the PostgreSQL data directory.

Could you please send us the server's configuration you are using, in
particular:

ssh_command

Also, any background on the installation process you followed and which
users you are using in your environment.

--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

杨华杰

unread,
Apr 15, 2013, 8:13:29 AM4/15/13
to Gabriele Bartolini, pgba...@googlegroups.com
Hi Gabriele

Thanks for the quick reply. I am using the ubuntu server 12.04.02, I didn't change any default configuration, I use the apt-get install all the softwares except barman. I install the latest barman 1.2 and followed the online instruction


Regards,
Hua Jie




 gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it


杨华杰

unread,
Apr 15, 2013, 8:19:32 AM4/15/13
to Gabriele Bartolini, pgba...@googlegroups.com
I am using postgres as the ssh user


On Mon, Apr 15, 2013 at 6:36 PM, Gabriele Bartolini <gabriele....@2ndquadrant.it> wrote:
 gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it


Gabriele Bartolini

unread,
Apr 15, 2013, 9:42:12 AM4/15/13
to pgba...@googlegroups.com, 杨华杰
Hi,

Il 15/04/13 14:19, 杨华杰 ha scritto:
> I am using postgres as the ssh user
That was not my question. :)

Can you please post the ssh_command option?

Thanks,
Gabriele

--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

Gabriele Bartolini

unread,
Apr 15, 2013, 9:43:32 AM4/15/13
to 杨华杰, pgba...@googlegroups.com
Il 15/04/13 14:13, 杨华杰 ha scritto:
Hi Gabriele

Thanks for the quick reply. I am using the ubuntu server 12.04.02, I didn't change any default configuration, I use the apt-get install all the softwares except barman. I install the latest barman 1.2 and followed the online instruction

If you are using Ubuntu, we normally suggest to install Barman directly from the available packages - maintained directly by us. It saves you a lot of trouble.

Cheers,
Gabriele
-- 
 Gabriele Bartolini - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

杨华杰

unread,
Apr 15, 2013, 10:48:38 AM4/15/13
to Gabriele Bartolini, pgba...@googlegroups.com
the version of barman in ubuntu is still 1.0

杨华杰

unread,
Apr 15, 2013, 10:52:45 AM4/15/13
to Gabriele Bartolini, pgba...@googlegroups.com
Hi Gabriele

Is this command you are looking for?
ssh postgres@ubuntuA


Regards,
Hua Jie


On Mon, Apr 15, 2013 at 9:42 PM, Gabriele Bartolini <gabriele....@2ndquadrant.it> wrote:
Hi,

Il 15/04/13 14:19, 杨华杰 ha scritto:

I am using postgres as the ssh user
That was not my question. :)

Can you please post the ssh_command option?

Thanks,
Gabriele


--
 Gabriele Bartolini - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it


Gabriele Bartolini

unread,
Apr 16, 2013, 3:18:14 AM4/16/13
to 杨华杰, pgba...@googlegroups.com
Hi,

On Mon, 15 Apr 2013 22:52:45 +0800, 杨华杰 <yhj...@gmail.com> wrote:
> Is this command you are looking for?
> ssh postgres@ubuntuA

Could you please connect to host ubuntuA as postgres user then type:

ls -la /var/lib/postgresql/9.1/main

Thanks,
Gabriele
--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
Gabriele....@2ndQuadrant.it - www.2ndQuadrant.it

杨华杰

unread,
Apr 16, 2013, 5:46:26 AM4/16/13
to pgba...@googlegroups.com, 杨华杰
Hi Gabriele

My configuration is not correct. I followed the instruction again.


Regards,
Hua Jie


On Tuesday, April 16, 2013 3:18:14 PM UTC+8, Support Watch wrote:
Hi,

 On Mon, 15 Apr 2013 22:52:45 +0800, 杨华杰 <yhj...@gmail.com> wrote:
> Is this command you are looking for?
> ssh postgres@ubuntuA

 Could you please connect to host ubuntuA as postgres user then type:

 ls -la /var/lib/postgresql/9.1/main

 Thanks,
 Gabriele
--
  Gabriele Bartolini - 2ndQuadrant Italia
  PostgreSQL Training, Services and Support
  Gabriele.Bartolini@2ndQuadrant.it - www.2ndQuadrant.it

Arif Hussain

unread,
Aug 15, 2013, 3:48:07 AM8/15/13
to pgba...@googlegroups.com, 杨华杰
I got same error. Here my ls -la /var/lib/postgresql/9.1/main:

postgres@uServer:~$ ls -la /var/lib/postgresql/9.1/main/
total 64
drwx------ 13 postgres postgres 4096 Aug 15 00:37 .
drwxr-xr-x  3 postgres postgres 4096 Aug 14 21:19 ..
drwx------  6 postgres postgres 4096 Aug 14 21:24 base
drwx------  2 postgres postgres 4096 Aug 15 00:09 global
drwx------  2 postgres postgres 4096 Aug 14 21:19 pg_clog
drwx------  4 postgres postgres 4096 Aug 14 21:19 pg_multixact
drwx------  2 postgres postgres 4096 Aug 15 00:08 pg_notify
drwx------  2 postgres postgres 4096 Aug 14 21:19 pg_serial
drwx------  2 postgres postgres 4096 Aug 15 00:44 pg_stat_tmp
drwx------  2 postgres postgres 4096 Aug 14 21:19 pg_subtrans
drwx------  2 postgres postgres 4096 Aug 14 21:19 pg_tblspc
drwx------  2 postgres postgres 4096 Aug 14 21:19 pg_twophase
-rw-------  1 postgres postgres    4 Aug 14 21:19 PG_VERSION
drwx------  3 postgres postgres 4096 Aug 15 00:42 pg_xlog
-rw-------  1 postgres postgres  133 Aug 15 00:08 postmaster.opts
-rw-------  1 postgres postgres   91 Aug 15 00:08 postmaster.pid
lrwxrwxrwx  1 root     root       36 Aug 14 21:19 server.crt -> /etc/ssl/certs/ssl-cert-snakeoil.pem
lrwxrwxrwx  1 root     root       38 Aug 14 21:19 server.key -> /etc/ssl/private/ssl-cert-snakeoil.key

Gabriele Bartolini

unread,
Aug 15, 2013, 3:51:53 AM8/15/13
to pgba...@googlegroups.com, Arif Hussain, 杨华杰
Hi Arif,

Il 15/08/13 09:48, Arif Hussain ha scritto:
> I got same error. Here my ls -la /var/lib/postgresql/9.1/main:
Exactly. Did you read this thread from the start?

Could you please copy here the recover command you used?

Thanks,
Gabriele

--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

Arif Hussain

unread,
Aug 15, 2013, 4:20:27 AM8/15/13
to pgba...@googlegroups.com, Arif Hussain, 杨华杰
I don't know what you mean by recover command. But my problem is when i run barman backup main i got error: rsync: change_dir "/var/lib/postgresql/9.1/main" failed: Permission denied (13)

Thanks.


On Thursday, August 15, 2013 3:51:53 PM UTC+8, Gabriele Bartolini wrote:
Hi Arif,

Il 15/08/13 09:48, Arif Hussain ha scritto:
> I got same error. Here my ls -la /var/lib/postgresql/9.1/main:
Exactly. Did you read this thread from the start?

Could you please copy here the recover command you used?

Thanks,
Gabriele

--
 Gabriele Bartolini - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it

Arif Hussain

unread,
Aug 16, 2013, 4:27:26 AM8/16/13
to pgba...@googlegroups.com, Arif Hussain, 杨华杰
Hi, I succesfully backup postgres server but i don't know where is the the path to recover directory. Hope u can help me..

Thanks


On Thursday, August 15, 2013 3:51:53 PM UTC+8, Gabriele Bartolini wrote:
Hi Arif,

Il 15/08/13 09:48, Arif Hussain ha scritto:
> I got same error. Here my ls -la /var/lib/postgresql/9.1/main:
Exactly. Did you read this thread from the start?

Could you please copy here the recover command you used?

Thanks,
Gabriele

--
 Gabriele Bartolini - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it

Gabriele Bartolini

unread,
Aug 16, 2013, 4:38:26 AM8/16/13
to pgba...@googlegroups.com
Il 16/08/13 10:27, Arif Hussain ha scritto:
> Hi, I succesfully backup postgres server but i don't know where is the
> the path to recover directory. Hope u can help me..
There is no such a recovery path. Recovery happens where you decide it
to. I do not understand your question. Could you please elaborate a use
case?

Thanks,
Gabriele

--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

Gabriele Bartolini

unread,
Aug 16, 2013, 3:47:33 AM8/16/13
to pgba...@googlegroups.com, Arif Hussain, 杨华杰
Il 15/08/13 10:20, Arif Hussain ha scritto:
> I don't know what you mean by recover command.
Sorry, I meant backup command.
> But my problem is when i run barman backup main i got error: rsync:
> change_dir "/var/lib/postgresql/9.1/main" failed: Permission denied (13)
Could you please paste the output of the "barman show-server SERVER"
command (please use the real name of your server instead of SERVER).

Thank you,
Gabriele

--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

Message has been deleted

Arif Hussain

unread,
Aug 18, 2013, 9:35:37 PM8/18/13
to pgba...@googlegroups.com, Arif Hussain, 杨华杰
backup command:

barman@uServer:~$ barman backup main
Starting backup for server main in /srv/barman/main/base/
20130818T181557
Backup start at xlog location: 0/35000020 (000000010000000000000035, 00000020)
Copying files.
Copy done.
Asking PostgreSQL server to finalize the backup.
Backup end at xlog location: 0/350000A0 (000000010000000000000035, 000000A0)
Backup completed

The result seem ok i guess.

And the output of the "barman show-server":

barman@uServer:~$ barman show-server main
Server main:
    active: true
    description: Main PostgreSQL Database
    ssh_command: ssh post...@192.168.56.23
    conninfo: host=192.168.56.23 user=postgres
    backup_directory: /srv/barman/main
    basebackups_directory: /srv/barman/main/base
    wals_directory: /srv/barman/main/wals
    incoming_wals_directory: /srv/barman/main/incoming
    lock_file: /srv/barman/main/main.lock
    compression: None
    custom_compression_filter: None
    custom_decompression_filter: None
    retention_policy_mode: auto
    retention_policy: None
    wal_retention_policy: main
    pre_backup_script: None
    post_backup_script: None
    minimum_redundancy: 0
    bandwidth_limit: None
    tablespace_bandwidth_limit: None
    current_xlog: 000000010000000000000036
    last_shipped_wal: 000000010000000000000035
    archive_command: rsync -a %p bar...@192.168.56.24:/srv/barman/main/incoming/%f
    server_txt_version: 9.1.9
    data_directory: /var/lib/postgresql/9.1/main
    archive_mode: on
    config_file: /etc/postgresql/9.1/main/postgresql.conf
    hba_file: /etc/postgresql/9.1/main/pg_hba.conf
    ident_file: /etc/postgresql/9.1/main/pg_ident.conf

Hopefully this may help you understand my problem.

Thank you.
 gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it

Reply all
Reply to author
Forward
0 new messages