Database is reporting fatal error about missing locale, but immich is working? #2572

Closed
opened 2026-02-05 06:12:56 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @DavyLandman on GitHub (Mar 13, 2024).

The bug

I was diagnosing an issue (which I solved), and happened to glance the log of the database. and it was printing these messages all the time (I just restarted it to make sure):

PostgreSQL Database directory appears to contain a database; Skipping initialization

2024-03-12 21:03:35.952 UTC [1] LOG:  starting PostgreSQL 15.6 (Debian 15.6-1.pgdg120+2) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-03-12 21:03:35.952 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-03-12 21:03:35.952 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-03-12 21:03:35.955 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-03-12 21:03:35.966 UTC [23] LOG:  database system was shut down at 2024-03-12 21:03:19 UTC
[2024-03-12T21:03:35Z INFO  service::utils::clean] Find directory "pg_vectors/indexes/243964".
[2024-03-12T21:03:35Z INFO  service::utils::clean] Find directory "pg_vectors/indexes/286292".
[2024-03-12T21:03:35Z INFO  service::utils::clean] Find directory "pg_vectors/indexes/286292/segments/b0b6134e-0c75-493a-a154-659678a53629".
[2024-03-12T21:03:35Z INFO  service::utils::clean] Find directory "pg_vectors/indexes/243964/segments/49b97c05-b3b0-4846-9cf0-a05f29a478e1".
2024-03-12 21:03:35.997 UTC [1] LOG:  database system is ready to accept connections
2024-03-12 21:03:56.065 UTC [36] FATAL:  database locale is incompatible with operating system
2024-03-12 21:03:56.065 UTC [36] DETAIL:  The database was initialized with LC_COLLATE "nl_NL.utf8",  which is not recognized by setlocale().
2024-03-12 21:03:56.065 UTC [36] HINT:  Recreate the database with another locale or install the missing locale.
2024-03-12 21:04:16.038 UTC [45] FATAL:  database locale is incompatible with operating system
2024-03-12 21:04:16.038 UTC [45] DETAIL:  The database was initialized with LC_COLLATE "nl_NL.utf8",  which is not recogniz
2024-03-12 21:04:16.038 UTC [45] HINT:  Recreate the database with another locale or install the missing locale.
2024-03-12 21:04:56.044 UTC [51] FATAL:  database locale is incompatible with operating system
2024-03-12 21:04:56.044 UTC [51] DETAIL:  The database was initialized with LC_COLLATE "nl_NL.utf8",  which is not recognized by setlocale().
2024-03-12 21:04:56.044 UTC [51] HINT:  Recreate the database with another locale or install the missing locale.
2024-03-12 21:05:16.047 UTC [52] FATAL:  database locale is incompatible with operating system
2024-03-12 21:05:16.047 UTC [52] DETAIL:  The database was initialized with LC_COLLATE "nl_NL.utf8",  which is not recognized by setlocale().
2024-03-12 21:05:16.047 UTC [52] HINT:  Recreate the database with another locale or install the missing locale.

I thought: hey that might be it, until I noticed it was just continuing, no restarts or anything.

The OS that Immich Server is running on

alpine & docker

Version of Immich Server

v1.98.2

Version of Immich Mobile App

v1.98.2

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload:z
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload:z
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg15-v0.2.0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    command: >
        -c max_connections=20
        -c shared_buffers=512MB
        -c effective_cache_size=1536MB
        -c maintenance_work_mem=128MB
        -c checkpoint_completion_target=0.9
        -c wal_buffers=16MB
        -c default_statistics_target=100
        -c random_page_cost=1.1
        -c effective_io_concurrency=200
        -c work_mem=13107kB
        -c min_wal_size=1GB
        -c max_wal_size=4GB
        -c shared_preload_libraries=vectors.so
        -c "search_path=\"$user\", public, vectors"
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

Your .env content

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=v1.98.2

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/box

TZ="Europe/Amsterdam"
REVERSE_GEOCODING_PRECISION=1

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=SNIIIP

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis


VAULTWARDEN_ADMIN_TOKEN=SNIPPP

Reproduction steps

1. log onto the server
2. docker-compose logs --tail 20 database

Additional information

At some point in the past I foolishly switched to postrgres 15, so that is why I use the pg15 image instead of the pg14 as the regular docker-compose says.

I have no idea when this error started appearing in the logs

Originally created by @DavyLandman on GitHub (Mar 13, 2024). ### The bug I was diagnosing an issue (which I solved), and happened to glance the log of the database. and it was printing these messages all the time (I just restarted it to make sure): ``` PostgreSQL Database directory appears to contain a database; Skipping initialization 2024-03-12 21:03:35.952 UTC [1] LOG: starting PostgreSQL 15.6 (Debian 15.6-1.pgdg120+2) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit 2024-03-12 21:03:35.952 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2024-03-12 21:03:35.952 UTC [1] LOG: listening on IPv6 address "::", port 5432 2024-03-12 21:03:35.955 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2024-03-12 21:03:35.966 UTC [23] LOG: database system was shut down at 2024-03-12 21:03:19 UTC [2024-03-12T21:03:35Z INFO service::utils::clean] Find directory "pg_vectors/indexes/243964". [2024-03-12T21:03:35Z INFO service::utils::clean] Find directory "pg_vectors/indexes/286292". [2024-03-12T21:03:35Z INFO service::utils::clean] Find directory "pg_vectors/indexes/286292/segments/b0b6134e-0c75-493a-a154-659678a53629". [2024-03-12T21:03:35Z INFO service::utils::clean] Find directory "pg_vectors/indexes/243964/segments/49b97c05-b3b0-4846-9cf0-a05f29a478e1". 2024-03-12 21:03:35.997 UTC [1] LOG: database system is ready to accept connections 2024-03-12 21:03:56.065 UTC [36] FATAL: database locale is incompatible with operating system 2024-03-12 21:03:56.065 UTC [36] DETAIL: The database was initialized with LC_COLLATE "nl_NL.utf8", which is not recognized by setlocale(). 2024-03-12 21:03:56.065 UTC [36] HINT: Recreate the database with another locale or install the missing locale. 2024-03-12 21:04:16.038 UTC [45] FATAL: database locale is incompatible with operating system 2024-03-12 21:04:16.038 UTC [45] DETAIL: The database was initialized with LC_COLLATE "nl_NL.utf8", which is not recogniz 2024-03-12 21:04:16.038 UTC [45] HINT: Recreate the database with another locale or install the missing locale. 2024-03-12 21:04:56.044 UTC [51] FATAL: database locale is incompatible with operating system 2024-03-12 21:04:56.044 UTC [51] DETAIL: The database was initialized with LC_COLLATE "nl_NL.utf8", which is not recognized by setlocale(). 2024-03-12 21:04:56.044 UTC [51] HINT: Recreate the database with another locale or install the missing locale. 2024-03-12 21:05:16.047 UTC [52] FATAL: database locale is incompatible with operating system 2024-03-12 21:05:16.047 UTC [52] DETAIL: The database was initialized with LC_COLLATE "nl_NL.utf8", which is not recognized by setlocale(). 2024-03-12 21:05:16.047 UTC [52] HINT: Recreate the database with another locale or install the missing locale. ``` I thought: hey that might be it, until I noticed it was just continuing, no restarts or anything. ### The OS that Immich Server is running on alpine & docker ### Version of Immich Server v1.98.2 ### Version of Immich Mobile App v1.98.2 ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML version: "3.8" services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} command: [ "start.sh", "immich" ] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload:z - /etc/localtime:/etc/localtime:ro env_file: - .env depends_on: - redis - database restart: always immich-microservices: container_name: immich_microservices image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} # extends: # file: hwaccel.yml # service: hwaccel command: [ "start.sh", "microservices" ] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload:z - /etc/localtime:/etc/localtime:ro env_file: - .env depends_on: - redis - database restart: always immich-machine-learning: container_name: immich_machine_learning image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} volumes: - model-cache:/cache env_file: - .env restart: always redis: container_name: immich_redis image: redis:6.2-alpine restart: always database: container_name: immich_postgres image: tensorchord/pgvecto-rs:pg15-v0.2.0 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} command: > -c max_connections=20 -c shared_buffers=512MB -c effective_cache_size=1536MB -c maintenance_work_mem=128MB -c checkpoint_completion_target=0.9 -c wal_buffers=16MB -c default_statistics_target=100 -c random_page_cost=1.1 -c effective_io_concurrency=200 -c work_mem=13107kB -c min_wal_size=1GB -c max_wal_size=4GB -c shared_preload_libraries=vectors.so -c "search_path=\"$user\", public, vectors" volumes: - pgdata:/var/lib/postgresql/data restart: always ``` ### Your .env content ```Shell # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION=v1.98.2 # The location where your uploaded files are stored UPLOAD_LOCATION=/mnt/box TZ="Europe/Amsterdam" REVERSE_GEOCODING_PRECISION=1 # Connection secrets for postgres and typesense. You should change these to random passwords TYPESENSE_API_KEY=SNIIIP # The values below this line do not need to be changed ################################################################################### DB_HOSTNAME=immich_postgres DB_USERNAME=postgres DB_DATABASE_NAME=immich REDIS_HOSTNAME=immich_redis VAULTWARDEN_ADMIN_TOKEN=SNIPPP ``` ### Reproduction steps ```bash 1. log onto the server 2. docker-compose logs --tail 20 database ``` ### Additional information At some point in the past I foolishly switched to postrgres 15, so that is why I use the `pg15` image instead of the `pg14` as the regular docker-compose says. I have no idea when this error started appearing in the logs
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2572