From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: omerfaruko@gmail.com
Subject: BUG #15810: Using custom directory on external HDD gives permission error
Date: Thu, 16 May 2019 16:15:39 +0000
Message-ID: <15810-c9f666eb398e40b7@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15810
Logged by: Omer Ozarslan
Email address: omerfaruko@gmail.com
PostgreSQL version: 11.3
Operating system: Debian 10 (buster)
Description:
Dear developers,
I have an external HDD formatted as exFAT. I am trying to create a postgres
database on it. It doesn't allow me to start database on that directory due
to a permission error.
Steps to reproduce:
```
omer@omer:~$ psql --version
psql (PostgreSQL) 11.3 (Debian 11.3-1)
omer@omer:~$ lsblk -no mountpoint,fstype /dev/sda1
/media/omer/My Book exfat
omer@omer:~$ /usr/lib/postgresql/11/bin/initdb /media/omer/My\
Book/ris/postgres_data
The files belonging to this database system will be owned by user "omer".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /media/omer/My Book/ris/postgres_data ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2019-05-16 11:06:01.342 CDT [29197] FATAL:
data directory "/media/omer/My Book/ris/postgres_data" has invalid
permissions
2019-05-16 11:06:01.342 CDT [29197] DETAIL: Permissions should be u=rwx
(0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing data directory "/media/omer/My Book/ris/postgres_data"
omer@omer:~$ /usr/lib/postgresql/11/bin/initdb -n /media/omer/My\
Book/ris/postgres_data
Running in no-clean mode. Mistakes will not be cleaned up.
The files belonging to this database system will be owned by user "omer".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /media/omer/My Book/ris/postgres_data ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2019-05-16 11:06:11.135 CDT [29250] FATAL:
data directory "/media/omer/My Book/ris/postgres_data" has invalid
permissions
2019-05-16 11:06:11.135 CDT [29250] DETAIL: Permissions should be u=rwx
(0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: data directory "/media/omer/My Book/ris/postgres_data" not removed
at user's request
omer@omer:~$ /usr/lib/postgresql/11/bin/pg_ctl -D /media/omer/My\
Book/ris/postgres_data start
waiting for server to start....2019-05-16 11:06:33.811 CDT [29255] FATAL:
data directory "/media/omer/My Book/ris/postgres_data" has invalid
permissions
2019-05-16 11:06:33.811 CDT [29255] DETAIL: Permissions should be u=rwx
(0700) or u=rwx,g=rx (0750).
stopped waiting
pg_ctl: could not start server
Examine the log output.
omer@omer:~$ ls -al /media/omer/My\ Book/ris/postgres_data
total 24576
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 .
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 ..
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 base
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 global
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_commit_ts
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_dynshmem
-rwxrwxrwx 1 omer omer 4513 May 16 11:06 pg_hba.conf
-rwxrwxrwx 1 omer omer 1636 May 16 11:06 pg_ident.conf
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_logical
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_multixact
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_notify
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_replslot
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_serial
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_snapshots
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_stat
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_stat_tmp
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_subtrans
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_tblspc
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_twophase
-rwxrwxrwx 1 omer omer 3 May 16 11:06 PG_VERSION
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_wal
drwxrwxrwx 1 omer omer 1048576 May 16 11:06 pg_xact
-rwxrwxrwx 1 omer omer 88 May 16 11:06 postgresql.auto.conf
-rwxrwxrwx 1 omer omer 23902 May 16 11:06 postgresql.conf
```
Here is where I found this error on source code:
https://github.com/postgres/postgres/blob/4b1fcb43d070ba8b34ea01d5a657630d76e4b33f/src/backend/utils...
Is there some way to circumvent this check without changing format of the
HDD?
Thanks,
Omer
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: noreply@postgresql.org, omerfaruko@gmail.com
Subject: Re: BUG #15810: Using custom directory on external HDD gives permission error
In-Reply-To: <15810-c9f666eb398e40b7@postgresql.org>
References: <15810-c9f666eb398e40b7@postgresql.org>
* 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