Cant restore from backup - database auth fail #16959
-
I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.
The bugrestoring from immich automatic backup fails when starting containers due to this is a fresh new volume and images pull docker compose has custom password for postgres. Same password, never changed... in new build or duration of backups. desired backup source location" after restoring, immich_server fails to authenticate with the DB I have tried:
The OS that Immich Server is running onUbuntu Server 24.04 Version of Immich Serverv1.129.0 Version of Immich Mobile Appv1.129.0 build.197 Platform with the issue
Your docker-compose.yml contentname: immich
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}transcoding
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
- ${PHOTO_LIBRARY_PATH}:${IMMICH_IMPORT_PATH}:ro # Map 4T SSD Photos directory, :ro = read only
ports:
- 2283:2283
depends_on:
- redis
- database
restart: always
healthcheck:
disable: false
immich-machine-learning:
container_name: immich_machine_learning
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
volumes:
- model-cache:/cache
restart: always
healthcheck:
disable: false
redis:
container_name: immich_redis
image: docker.io/redis:6.2-alpine@sha256:905c4ee67b8e0aa955331960d2aa745781e6bd89afc44a8584bfd13bc890f0ae
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_postgres
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
command: >-
postgres
-c shared_preload_libraries=vectors.so
-c 'search_path="$$user", public, vectors'
-c logging_collector=on
-c max_wal_size=2GB
-c shared_buffers=512MB
-c wal_compression=on
restart: always
volumes:
model-cache:Your .env contentUPLOAD_LOCATION=/home/myuser/docker/immich/library
DB_DATA_LOCATION=/home/myuser/docker/immich/postgres
PHOTO_LIBRARY_PATH=/mnt/nfs_mounted_library
IMMICH_IMPORT_PATH=/usr/src/app/import
IMMICH_VERSION=release
DB_PASSWORD=mycustompassword123
DB_USERNAME=postgres
DB_DATABASE_NAME=immichReproduction steps
log from restore Relevant log outputimmich_server | Starting api worker
immich_server | Starting microservices worker
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [NestFactory] Starting Nest application...
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] BullModule dependencies initialized +1ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
immich_server | error: password authentication failed for user "postgres"
immich_server | at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:283:98)
immich_server | at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:122:29)
immich_server | at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:35:38)
immich_server | at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
immich_server | at Socket.emit (node:events:524:28)
immich_server | at addChunk (node:internal/streams/readable:561:12)
immich_server | at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
immich_server | at Readable.push (node:internal/streams/readable:392:5)
immich_server | at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] ClsModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] ClsCommonModule dependencies initialized +1ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] OpenTelemetryModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] KyselyModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] KyselyCoreModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] OpenTelemetryCoreModule dependencies initialized +1ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] ClsRootModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms
immich_server | [Nest] 17 - 03/18/2025, 5:37:43 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
immich_server | error: password authentication failed for user "postgres"
immich_server | at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:283:98)
immich_server | at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:122:29)
immich_server | at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:35:38)
immich_server | at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
immich_server | at Socket.emit (node:events:524:28)
immich_server | at addChunk (node:internal/streams/readable:561:12)
immich_server | at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
immich_server | at Readable.push (node:internal/streams/readable:392:5)
immich_server | at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
...
...
immich_server | length: 104,
immich_server | severity: 'FATAL',
immich_server | code: '28P01',
immich_server | detail: undefined,
immich_server | hint: undefined,
immich_server | position: undefined,
immich_server | internalPosition: undefined,
immich_server | internalQuery: undefined,
immich_server | where: undefined,
immich_server | schema: undefined,
immich_server | table: undefined,
immich_server | column: undefined,
immich_server | dataType: undefined,
immich_server | constraint: undefined,
immich_server | file: 'auth.c',
immich_server | line: '335',
immich_server | routine: 'auth_failed'
immich_server | }
immich_server | api worker exited with code 1Additional informationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
|
Also tried on Mac osx where docker doesn’t require sudo like the initial headless Linux server. Same result. Can’t connect to database due to authorization. |
Beta Was this translation helpful? Give feedback.
-
|
as a test I was able to restore from a manually created backup using documented command from https://immich.app/docs/administration/backup-and-restore I did have to create the subfolders in library and the .immich files but it worked. I still need to restore from the automatically created backup :-( |
Beta Was this translation helpful? Give feedback.
-
|
I have manually tried to authenticate in the postgres container with the password set in the .env and it works. So im not sure why the app cant log in when starting |
Beta Was this translation helpful? Give feedback.
-
|
I verified the db username and password are correct from the immich_server container console, I logged in to the psql database with the password from the .env file and ran a query verifying the password works and the db contains the correct information. from the immich_postgres container any password works since its local and trusted immich_server container console: but im still seeing the same immich_server error I tried with a manually created backup and everything works fine... for some reason I just cant get the server to connect to the db from that automatic backup I really need to restore to |
Beta Was this translation helpful? Give feedback.
-
|
SOLVED found the issue... |
Beta Was this translation helpful? Give feedback.
SOLVED
found the issue...
docker-compose.ymlfile was missing the env file specification thus it was never using the db password and name information