[bitnami/postgresql] data directory "/bitnami/postgresql/data" has wrong ownership
Name and Version
/bitnami/postgresql/16.4.0-debian-12-r5
What architecture are you using?
None
What steps will reproduce the bug?
Environment- AWS EKS V 1.28
kubectl logs -f my-postgresql-0
postgresql 16:05:51.64 INFO ==>
postgresql 16:05:51.72 INFO ==> Welcome to the Bitnami postgresql container
postgresql 16:05:51.73 INFO ==> Subscribe to project updates by watching https://github.com/bitnami/containers
postgresql 16:05:51.73 INFO ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
postgresql 16:05:51.73 INFO ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise
postgresql 16:05:51.74 INFO ==>
postgresql 16:05:51.83 DEBUG ==> Configuring libnss_wrapper...
postgresql 16:05:51.92 DEBUG ==> Copying files from /opt/bitnami/postgresql/conf.default to /opt/bitnami/postgresql/conf
postgresql 16:05:51.93 INFO ==> ** Starting PostgreSQL setup **
postgresql 16:05:52.04 INFO ==> Validating settings in POSTGRESQL_* env vars..
postgresql 16:05:52.14 INFO ==> Loading custom pre-init scripts...
postgresql 16:05:52.15 INFO ==> Initializing PostgreSQL database...
postgresql 16:05:52.22 DEBUG ==> Ensuring expected directories/files exist...
postgresql 16:05:52.32 INFO ==> pg_hba.conf file not detected. Generating it...
postgresql 16:05:52.33 INFO ==> Generating local authentication configuration
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /bitnami/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
2024-08-31 16:05:55.147 UTC [101] FATAL: data directory "/bitnami/postgresql/data" has wrong ownership
2024-08-31 16:05:55.147 UTC [101] HINT: The server must be started by the user that owns the data directory.
child process exited with exit code 1
initdb: removing contents of data directory "/bitnami/postgresql/data"
Are you using any custom parameters or values?
no
What is the expected behavior?
No response
What do you see instead?
After I installed the Helm chart the the pod went to crashloopbackoff status.
my-postgresql-0 0/1 CrashLoopBackOff 10 (80s ago) 28m
Additional information
No response
Hi!
Could you add more details on the PVC provider you are using? It may have incompatibilities with fsGroup
I use EFS CSI Provisioner
Could you try with the volume permissions init container? volumePermissions.enabled=true?
Could you try with the volume permissions init container?
volumePermissions.enabled=true?
I tried it. But it didn't work
Could you deploy the chart with diagnosticMode.enabled=true, enter the container with kubectl exec and check the permissions on the volume folder?
@javsalgar I have same problem.
The default user id of EFS is 50011, so I tried below config but it doesn't works.
volumePermissions:
enabled: true
containerSecurityContext:
runAsUser: 50011
runAsGroup: 50011
runAsNonRoot: false
Even with that user/group, you are unable to perform a touch command inside the container? What error does it show?
@javsalgar The volumePermissions doesn't works, but when I configure containerSecurityContext to below, it's works.
primary:
containerSecurityContext:
runAsUser: 50011
runAsGroup: 50011
runAsNonRoot: true
readReplicas:
containerSecurityContext:
runAsUser: 50011
runAsGroup: 50011
runAsNonRoot: true
@javsalgar The
volumePermissionsdoesn't works, but when I configurecontainerSecurityContextto below, it's works.primary: containerSecurityContext: runAsUser: 50011 runAsGroup: 50011 runAsNonRoot: true readReplicas: containerSecurityContext: runAsUser: 50011 runAsGroup: 50011 runAsNonRoot: true
I tried this, But it didn't work. Can you please provide the complete values file.
I have the same error with the docker container running with docker compose with BITNAMI_DEBUG=true.
It worked fine a month ago... I didn't change anything on my setup.
I'm using bitnami/postgresql:16.
I tried bitnami/postgresql:17 and I have the same error.
postgres-1 | postgresql 13:18:25.10 INFO ==> Generating local authentication configuration
postgres-1 | The files belonging to this database system will be owned by user "postgres".
postgres-1 | This user must also own the server process.
postgres-1 |
postgres-1 | The database cluster will be initialized with locale "en_US.UTF-8".
postgres-1 | The default text search configuration will be set to "english".
postgres-1 |
postgres-1 | Data page checksums are disabled.
postgres-1 |
postgres-1 | fixing permissions on existing directory /bitnami/postgresql/data ... ok
postgres-1 | creating subdirectories ... ok
postgres-1 | selecting dynamic shared memory implementation ... posix
postgres-1 | selecting default "max_connections" ... 100
postgres-1 | selecting default "shared_buffers" ... 128MB
postgres-1 | selecting default time zone ... Etc/UTC
postgres-1 | creating configuration files ... ok
postgres-1 | 2024-10-02 13:18:25.207 UTC [58] FATAL: data directory "/bitnami/postgresql/data" has wrong ownership
postgres-1 | 2024-10-02 13:18:25.207 UTC [58] HINT: The server must be started by the user that owns the data directory.
postgres-1 | child process exited with exit code 1
postgres-1 | initdb: removing contents of data directory "/bitnami/postgresql/data"
postgres-1 | running bootstrap script ...
I have the same error with the docker container running with docker compose with BITNAMI_DEBUG=true. It worked fine a month ago... I didn't change anything on my setup. I'm using
bitnami/postgresql:16. I triedbitnami/postgresql:17and I have the same error.postgres-1 | postgresql 13:18:25.10 INFO ==> Generating local authentication configuration postgres-1 | The files belonging to this database system will be owned by user "postgres". postgres-1 | This user must also own the server process. postgres-1 | postgres-1 | The database cluster will be initialized with locale "en_US.UTF-8". postgres-1 | The default text search configuration will be set to "english". postgres-1 | postgres-1 | Data page checksums are disabled. postgres-1 | postgres-1 | fixing permissions on existing directory /bitnami/postgresql/data ... ok postgres-1 | creating subdirectories ... ok postgres-1 | selecting dynamic shared memory implementation ... posix postgres-1 | selecting default "max_connections" ... 100 postgres-1 | selecting default "shared_buffers" ... 128MB postgres-1 | selecting default time zone ... Etc/UTC postgres-1 | creating configuration files ... ok postgres-1 | 2024-10-02 13:18:25.207 UTC [58] FATAL: data directory "/bitnami/postgresql/data" has wrong ownership postgres-1 | 2024-10-02 13:18:25.207 UTC [58] HINT: The server must be started by the user that owns the data directory. postgres-1 | child process exited with exit code 1 postgres-1 | initdb: removing contents of data directory "/bitnami/postgresql/data" postgres-1 | running bootstrap script ...
I manage to make it work by using docker volume instead of bind mount. But it's strange, it previously worked with a bind mount volume before.
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.