Immich installation with Portainer postgress issue

Data page checksums are disabled.
initdb: error: could not change permissions of directory “/var/lib/postgresql/data”: Operation not permitted
fixing permissions on existing directory /var/lib/postgresql/data … Schmod: changing permissions of ‘/var/lib/postgresql/data’: Operation not permitted
chmod: changing permissions of ‘/var/lib/postgresql/data’: Operation not permitted
The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.

I get the error above, could someone please help me out? I’d more than happy if someone know how to solve the issue.

I’ve tried the same portainer config on my Synology NAS and there there is no problem with the permission. What do I have to “allow” for it to work?

Thank you!

KR
Rok

Postgress needs r/w permissions for user 999

1 Like

I’ve allowed the user netdata that has 999 configured to change the folder but that didn’t help either. What should I do i my case?

Thx for your help!

My config for the DB:

immich-db:
image: tensorchord/pgvecto-rs:pg16-v0.2.0
container_name: immich-db
hostname: immich-db
security_opt:
- no-new-privileges:true
healthcheck:
test: [“CMD”, “pg_isready”, “-q”, “-d”, “immich”, “-U”, “immichuser”]
interval: 10s
timeout: 5s
retries: 5
volumes:
- /mnt/ssd_pool/docker/immich/db:/var/lib/postgresql/data:rw
environment:
- TZ=Europe/Vienna
- POSTGRES_DB=
- POSTGRES_USER=
- POSTGRES_PASSWORD=
networks:
manual:
ipv4_address: 172.20.0.32
restart: on-failure:5

I found as solution to my problem. Had to create all the folders as Generic and swap the root user with netdata (UID 999) which is needed for the DB to make changes.

Glad you got it figured out. Alternatively, you can create a generic dataset for postgres and then use this Automatic Permissions checkbox when installing the app. Same applies for any app with a postgres storage location.

image

1 Like