Sample Header Ad - 728x90

Postgres 15.3 fails to create new tablespace (could not set permissions)

0 votes
1 answer
1246 views
I am unable to create new tablespaces on a fresh Postgres 15.3 installation on Ubuntu 22.04. I tried the following so far: - re-install Postgres - fully loosen file system permission - disabled SELinux But still the postgres user reports it cannot set permissions on the tablespace folder. The log is below.
$ mkdir -p /media/user/Work/Databases/geo

$ chown -R postgres:postgres /media/user/Work/Databases

$ sudo chmod -R 777 /media/user/Work/Databases

$ setenforce 0
setenforce: SELinux is disabled

$ sestatus
SELinux status:                 disabled

$ sudo su postgres
postgres@luis-workstation:/home/user$ psql
could not change directory to "/home/user": Permission denied
psql (15.3 (Ubuntu 15.3-1.pgdg22.04+1))
Type "help" for help.

postgres=# CREATE TABLESPACE geo
  OWNER postgres
  LOCATION '/media/user/Work/Databases/geo';
ERROR:  could not set permissions on directory "/media/user/Work/Databases/geo": Permission denied
Asked by Luís de Sousa (674 rep)
Jul 6, 2023, 07:36 AM
Last activity: Nov 20, 2023, 10:31 AM