pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: c@osss.net
To: pgsql-bugs@lists.postgresql.org
Subject: Misleading/inaccurate error message from pg_basebackup
Date: Mon, 22 Jan 2024 11:47:09 -0500
Message-ID: <8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net> (raw)

pg_basebackup can throw an error which is inaccurate and misleading:

$ mkdir /var/lib/postgresql/14
$ ls -ld /var/lib/postgresql/14
drwxr-x--- 2 postgres postgres 6 Jan 22 16:08 /var/lib/postgresql/14
$ pg_basebackup --version
Error: /var/lib/postgresql/14/main is not accessible; please fix the directory permissions (/var/lib/postgresql/14/ should be world readable)

Reading that error suggests that I need to make the directory /var/lib/postgresql/14 world-readable, but doing so does not fix the problem, as the actual problem is that the main subdirectory does not exist:

$ chmod a+rx /var/lib/postgresql/14
$ ls -ld /var/lib/postgresql/14
drwxr-xr-x 2 postgres postgres 6 Jan 22 16:08 /var/lib/postgresql/14
$ pg_basebackup --version
Error: /var/lib/postgresql/14/main is not accessible; please fix the directory permissions (/var/lib/postgresql/14/ should be world readable)

In fact it does not need to be world readable at all - the subdirectory just needs to be created:

$ chmod o-rx /var/lib/postgresql/14
$ mkdir /var/lib/postgresql/14/main
$ ls -ld /var/lib/postgresql/14{,/main}
drwxr-x--- 3 postgres postgres 19 Jan 22 16:14 /var/lib/postgresql/14
drwxr-x--- 2 postgres postgres  6 Jan 22 16:14 /var/lib/postgresql/14/main
$ pg_basebackup --version
pg_basebackup (PostgreSQL) 14.10 (Ubuntu 14.10-1.pgdg20.04+1)

This check is being done in cases where it's unnecessary, as it shouldn't matter at all when running a simple --version or --help, anyways.

-- 
Regards,
Casey




view thread (8+ messages)  latest in thread

Message-ID: <8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net>
Permalink:  ../8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net/
Also on:    postgresql.org/message-id/8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: c@osss.net
  Subject: Re: Misleading/inaccurate error message from pg_basebackup
  In-Reply-To: <8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net>
  References: <8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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