PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15810
PG Version11.3
OSDebian 10 (buster)
Opened2019-05-16 16:15:39+00
Reported byOmer Ozarslan
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15810
Logged by:          Omer Ozarslan
Email address:      (redacted)
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/init/miscinit.c#L161

Is there some way to circumvent this check without changing format of the
HDD?

Thanks,
Omer

Messages

DateAuthorSubject
2019-05-16 16:15:39+00PG Bug reporting formBUG #15810: Using custom directory on external HDD gives permission error
2019-05-16 23:43:51+00Michael PaquierRe: BUG #15810: Using custom directory on external HDD gives permission error
2019-05-16 23:59:33+00Tom LaneRe: BUG #15810: Using custom directory on external HDD gives permission error
2019-05-17 03:29:15+00Omer OzarslanRe: BUG #15810: Using custom directory on external HDD gives permission error
2019-05-17 03:39:19+00Omer OzarslanRe: BUG #15810: Using custom directory on external HDD gives permission error
2019-05-17 03:43:56+00Tom LaneRe: BUG #15810: Using custom directory on external HDD gives permission error
2019-05-17 04:08:11+00Omer OzarslanRe: BUG #15810: Using custom directory on external HDD gives permission error