could not open statistics file "pg_stat_tmp/global.stat": Permission denied #6451

Closed
opened 2026-02-05 12:17:55 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @ForumLiker on GitHub (Jul 10, 2025).

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

immich_postgres 14-vectorchord0.4.3-pgvector0.8.0-pgvectors0.2.0 gives an error in its logs
could not open statistics file "pg_stat_tmp/global.stat": Permission denied
I noticed that this happens after changing the owner of the directory /home/user/docker/immich/data
The owner is changed automatically to a regular user.
Today it happened after opening the mobile app. Before that I hadn't opened the app for several days. Maybe it's a coincidence

The OS that Immich Server is running on

armbian ubuntu server 24.04

Version of Immich Server

1.135.3

Version of Immich Mobile App

1.135.1

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - stack.env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    restart: always

volumes:
  model-cache:

Your .env content

UPLOAD_LOCATION=/home/user/media/immich/upload
DB_DATA_LOCATION=/home/user/docker/immich/data
TZ=Europe/Minsk
IMMICH_VERSION=release
DB_PASSWORD=postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

The problem existed in previous versions too.

Relevant log output

2025-07-10 15:52:07.921 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.931 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.941 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.951 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.962 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.972 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.982 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:07.993 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:08.003 UTC [39] LOG:  using stale statistics instead of current ones because stats collector is not responding
2025-07-10 15:52:08.003 UTC [39] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2025-07-10 15:52:16.228 UTC [1540] FATAL:  could not open file "global/pg_filenode.map": Permission denied
2025-07-10 15:52:45.247 UTC [1] LOG:  could not open file "postmaster.pid": Permission denied; continuing anyway
2025-07-10 15:52:45.556 UTC [1541] FATAL:  could not open file "global/pg_filenode.map": Permission denied
2025-07-10 15:53:02.700 UTC [1] LOG:  received fast shutdown request
2025-07-10 15:53:02.700 UTC [1] LOG:  could not open file "postmaster.pid": Permission denied
2025-07-10 15:53:02.700 UTC [1] LOG:  aborting any active transactions
2025-07-10 15:53:02.722 UTC [1] LOG:  background worker "logical replication launcher" (PID 41) exited with exit code 1
2025-07-10 15:53:02.728 UTC [36] LOG:  shutting down
2025-07-10 15:53:02.728 UTC [36] PANIC:  could not open file "/var/lib/postgresql/data/global/pg_control": Permission denied
2025-07-10 15:53:02.733 UTC [1] LOG:  checkpointer process (PID 36) was terminated by signal 6: Aborted
2025-07-10 15:53:02.733 UTC [1] LOG:  terminating any other active server processes
2025-07-10 15:53:02.733 UTC [40] LOG:  could not open temporary statistics file "pg_stat/global.tmp": Permission denied
2025-07-10 15:53:02.742 UTC [1] LOG:  abnormal database system shutdown
2025-07-10 15:53:02.768 UTC [1] LOG:  database system is shut down

Additional information

No response

Originally created by @ForumLiker on GitHub (Jul 10, 2025). ### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report. - [x] Yes ### The bug immich_postgres 14-vectorchord0.4.3-pgvector0.8.0-pgvectors0.2.0 gives an error in its logs `could not open statistics file "pg_stat_tmp/global.stat": Permission denied` I noticed that this happens after changing the owner of the directory _/home/user/docker/immich/data_ The owner is changed automatically to a regular user. Today it happened after opening the mobile app. Before that I hadn't opened the app for several days. Maybe it's a coincidence ### The OS that Immich Server is running on armbian ubuntu server 24.04 ### Version of Immich Server 1.135.3 ### Version of Immich Mobile App 1.135.1 ### Platform with the issue - [x] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML name: immich services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} # extends: # file: hwaccel.transcoding.yml # service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding volumes: # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - stack.env ports: - '2283:2283' depends_on: - redis - database restart: always healthcheck: disable: false immich-machine-learning: container_name: immich_machine_learning # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag. # Example tag: ${IMMICH_VERSION:-release}-cuda image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration # file: hwaccel.ml.yml # service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable volumes: - model-cache:/cache env_file: - stack.env restart: always healthcheck: disable: false redis: container_name: immich_redis image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177 healthcheck: test: redis-cli ping || exit 1 restart: always database: container_name: immich_postgres image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0 environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} POSTGRES_INITDB_ARGS: '--data-checksums' volumes: # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file - ${DB_DATA_LOCATION}:/var/lib/postgresql/data restart: always volumes: model-cache: ``` ### Your .env content ```Shell UPLOAD_LOCATION=/home/user/media/immich/upload DB_DATA_LOCATION=/home/user/docker/immich/data TZ=Europe/Minsk IMMICH_VERSION=release DB_PASSWORD=postgres DB_USERNAME=postgres DB_DATABASE_NAME=immich ``` ### Reproduction steps The problem existed in previous versions too. ### Relevant log output ```shell 2025-07-10 15:52:07.921 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.931 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.941 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.951 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.962 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.972 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.982 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:07.993 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:08.003 UTC [39] LOG: using stale statistics instead of current ones because stats collector is not responding 2025-07-10 15:52:08.003 UTC [39] WARNING: could not open statistics file "pg_stat_tmp/global.stat": Permission denied 2025-07-10 15:52:16.228 UTC [1540] FATAL: could not open file "global/pg_filenode.map": Permission denied 2025-07-10 15:52:45.247 UTC [1] LOG: could not open file "postmaster.pid": Permission denied; continuing anyway 2025-07-10 15:52:45.556 UTC [1541] FATAL: could not open file "global/pg_filenode.map": Permission denied 2025-07-10 15:53:02.700 UTC [1] LOG: received fast shutdown request 2025-07-10 15:53:02.700 UTC [1] LOG: could not open file "postmaster.pid": Permission denied 2025-07-10 15:53:02.700 UTC [1] LOG: aborting any active transactions 2025-07-10 15:53:02.722 UTC [1] LOG: background worker "logical replication launcher" (PID 41) exited with exit code 1 2025-07-10 15:53:02.728 UTC [36] LOG: shutting down 2025-07-10 15:53:02.728 UTC [36] PANIC: could not open file "/var/lib/postgresql/data/global/pg_control": Permission denied 2025-07-10 15:53:02.733 UTC [1] LOG: checkpointer process (PID 36) was terminated by signal 6: Aborted 2025-07-10 15:53:02.733 UTC [1] LOG: terminating any other active server processes 2025-07-10 15:53:02.733 UTC [40] LOG: could not open temporary statistics file "pg_stat/global.tmp": Permission denied 2025-07-10 15:53:02.742 UTC [1] LOG: abnormal database system shutdown 2025-07-10 15:53:02.768 UTC [1] LOG: database system is shut down ``` ### Additional information _No response_
Author
Owner

@bo0tzz commented on GitHub (Jul 10, 2025):

I noticed that this happens after changing the owner of the directory /home/user/docker/immich/data
The owner is changed automatically to a regular user.

Don't do that

@bo0tzz commented on GitHub (Jul 10, 2025): > I noticed that this happens after changing the owner of the directory /home/user/docker/immich/data The owner is changed automatically to a regular user. Don't do that
Author
Owner

@ForumLiker commented on GitHub (Jul 10, 2025):

@bo0tzz don't do what? it's done automatically

@ForumLiker commented on GitHub (Jul 10, 2025): @bo0tzz don't do what? it's done automatically
Author
Owner

@bo0tzz commented on GitHub (Jul 10, 2025):

Then you'll need to figure out what's doing it and turn that off.

@bo0tzz commented on GitHub (Jul 10, 2025): Then you'll need to figure out what's doing it and turn that off.
Author
Owner

@ForumLiker commented on GitHub (Jul 11, 2025):

@bo0tzz How do I understand this? I don't know. I thought Postgres did this, because only Postgres has rights. What owner and group should this file and other database directories have?

@ForumLiker commented on GitHub (Jul 11, 2025): @bo0tzz How do I understand this? I don't know. I thought Postgres did this, because only Postgres has rights. What owner and group should this file and other database directories have?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#6451