I
Immichβ€’4mo ago
Protenix

Server container crashing after miniature job request

Immich version 1.120.1 on windows running with docker desktop, was working fine for a month and more I tried to rebuild the thumbnails with the appropriate job, the server container crashed. Since then it restarts and crashes again every few seconds. The other containers start normally. using
docker exec -it immich_postgres psql --dbname=immich --username=postgres --command="SELECT datname, checksum_failures, checksum_last_failure FROM pg_stat_database WHERE datname IS NOT NULL"
docker exec -it immich_postgres psql --dbname=immich --username=postgres --command="SELECT datname, checksum_failures, checksum_last_failure FROM pg_stat_database WHERE datname IS NOT NULL"
returns
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: could not access status of transaction 3508200261
DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: could not access status of transaction 3508200261
DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
69 Replies
Immich
Immichβ€’4mo ago
:wave: Hey @Protenix, Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:. References - Container Logs: docker compose logs docs - Container Status: docker ps -a docs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy - Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA Checklist I have... 1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time). 2. :blue_square: read applicable release notes. 3. :blue_square: reviewed the FAQs for known issues. 4. :blue_square: reviewed Github for known issues. 5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy). 6. :blue_square: uploaded the relevant information (see below). 7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable (an item can be marked as "complete" by reacting with the appropriate number) Information In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider: - Your docker-compose.yml and .env files. - Logs from all the containers and their status (see above). - All the troubleshooting steps you've tried so far. - Any recent changes you've made to Immich or your system. - Details about your system (both software/OS and hardware). - Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h). - The version of the Immich server, mobile app, and other relevant pieces. - Any other information that you think might be relevant. Please paste files and logs with proper code formatting, and especially avoid blurry screenshots. Without the right information we can't work out what the problem is. Help us help you ;) If this ticket can be closed you can use the /close command, and re-open it later if needed.
Protenix
ProtenixOPβ€’4mo ago
It's difficult to get the docker log of the exact moment it crashes, I've noticed two errors so far: Failed to decode DCT block (which I think is not relevant) and this
[Nest] 7 - 01/04/2025, 5:02:07 PM LOG [NestFactory] Starting Nest application...
Initializing Immich v1.120.1
at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
[Nest] 19 - 01/04/2025, 5:01:19 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
error: could not access status of transaction 3508200261
at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23
[Nest] 7 - 01/04/2025, 5:02:07 PM LOG [NestFactory] Starting Nest application...
Initializing Immich v1.120.1
at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
[Nest] 19 - 01/04/2025, 5:01:19 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
error: could not access status of transaction 3508200261
at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23
bo0tzz
bo0tzzβ€’4mo ago
There's something wrong with your database. Probably some corruption in the filesystem, which is pretty bad. What do the postgres logs say?
Protenix
ProtenixOPβ€’4mo ago
2024-12-07 10:27:18 2024-12-07 09:27:18.108 UTC [1] LOG: redirecting log output to logging collector process
2024-12-07 10:27:18 2024-12-07 09:27:18.108 UTC [1] HINT: Future log output will appear in directory "log".
2025-01-03 16:50:57 PostgreSQL Database directory appears to contain a database; Skipping initialization
2024-12-07 10:27:18 2024-12-07 09:27:18.108 UTC [1] LOG: redirecting log output to logging collector process
2024-12-07 10:27:18 2024-12-07 09:27:18.108 UTC [1] HINT: Future log output will appear in directory "log".
2025-01-03 16:50:57 PostgreSQL Database directory appears to contain a database; Skipping initialization
just this I'm not sure what to try next. Should I try to use the restore database function on this page? https://immich.app/docs/administration/backup-and-restore/ Should I update immich before doing this? Should I do something different?
bo0tzz
bo0tzzβ€’4mo ago
Future log output will appear in directory "log".
The actual logs will be inside the postgres data folder
Protenix
ProtenixOPβ€’4mo ago
I'm not sure how to access them πŸ€”
bo0tzz
bo0tzzβ€’4mo ago
The postgres folder next to the compose file Or wherever you set DB_DATA_LOCATION to
Protenix
ProtenixOPβ€’4mo ago
in .env file DB_DATA_LOCATION=pgdata However, there is no folder pgdata in the immich directory or subdirectory (and there never was). I think maybe it is on the linux vm or in the container files? I tried browsing a bit with the linux shell and with docker desktop "files" tab, but I could not find it
No description
Zeus
Zeusβ€’4mo ago
Thats a docker volume
Protenix
ProtenixOPβ€’4mo ago
Nevermind I found it in docker desktop container file browser under /var/lib/postgresql/data as stated in docker-compose.yml This is the last log:
UTC [1] LOG: starting PostgreSQL 14.10 (Debian 14.10-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-01-04 17:00:38.291 UTC [1] LOG: listening on IPv6 address "::", port 5432
UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
UTC [27] LOG: database system was shut down at 2025-01-03 20:56:12 UTC
[2025-01-04T17:00:38Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061".
[2025-01-04T17:00:38Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767".
[2025-01-04T17:00:38Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061/segments/0717f022-89c3-4f1a-87b5-bc1b90def723".
2025-01-04 17:00:38.516 UTC [1] LOG: database system is ready to accept connections
2025-01-04 17:00:38.540 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:38.540 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
2025-01-04 17:00:39.541 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:39.541 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
2025-01-04 17:00:40.542 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:40.542 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
[2025-01-04T17:00:40Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767/segments/9344fd82-ade5-4285-b69d-84b3de4c9d57".
2025-01-04 17:00:41.543 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:41.543 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
2025-01-04 17:00:42.544 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:42.544 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
UTC [1] LOG: starting PostgreSQL 14.10 (Debian 14.10-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-01-04 17:00:38.291 UTC [1] LOG: listening on IPv6 address "::", port 5432
UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
UTC [27] LOG: database system was shut down at 2025-01-03 20:56:12 UTC
[2025-01-04T17:00:38Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061".
[2025-01-04T17:00:38Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767".
[2025-01-04T17:00:38Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061/segments/0717f022-89c3-4f1a-87b5-bc1b90def723".
2025-01-04 17:00:38.516 UTC [1] LOG: database system is ready to accept connections
2025-01-04 17:00:38.540 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:38.540 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
2025-01-04 17:00:39.541 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:39.541 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
2025-01-04 17:00:40.542 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:40.542 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
[2025-01-04T17:00:40Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767/segments/9344fd82-ade5-4285-b69d-84b3de4c9d57".
2025-01-04 17:00:41.543 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:41.543 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
2025-01-04 17:00:42.544 UTC [32] ERROR: could not access status of transaction 3508200261
2025-01-04 17:00:42.544 UTC [32] DETAIL: Could not open file "pg_xact/0D11": No such file or directory.
(It just repeats the last two lines)
Zeus
Zeusβ€’4mo ago
This is a weird error
Protenix
ProtenixOPβ€’4mo ago
I went back to a log from yesterday afternoon
Protenix
ProtenixOPβ€’4mo ago
This is the first occurence of the error. Previous log was:
2025-01-03 15:50:58.965 UTC [1] LOG: starting PostgreSQL 14.10 (Debian 14.10-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-01-03 15:50:58.967 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-01-03 15:50:58.967 UTC [1] LOG: listening on IPv6 address "::", port 5432
2025-01-03 15:50:59.032 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-01-03 15:50:59.080 UTC [27] LOG: database system was interrupted; last known up at 2025-01-03 15:04:52 UTC
[2025-01-03T15:50:59Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061".
[2025-01-03T15:50:59Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767".
[2025-01-03T15:50:59Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061/segments/0717f022-89c3-4f1a-87b5-bc1b90def723".
[2025-01-03T15:51:02Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767/segments/9344fd82-ade5-4285-b69d-84b3de4c9d57".
2025-01-03 15:51:03.818 UTC [27] LOG: database system was not properly shut down; automatic recovery in progress
2025-01-03 15:51:03.848 UTC [27] LOG: redo starts at 7/2DF52400
2025-01-03 15:51:03.848 UTC [27] LOG: invalid record length at 7/2DF524E8: wanted 24, got 0
2025-01-03 15:51:03.848 UTC [27] LOG: redo done at 7/2DF524B0 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2025-01-03 15:51:04.040 UTC [1] LOG: database system is ready to accept connections
2025-01-03 15:50:58.965 UTC [1] LOG: starting PostgreSQL 14.10 (Debian 14.10-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-01-03 15:50:58.967 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-01-03 15:50:58.967 UTC [1] LOG: listening on IPv6 address "::", port 5432
2025-01-03 15:50:59.032 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-01-03 15:50:59.080 UTC [27] LOG: database system was interrupted; last known up at 2025-01-03 15:04:52 UTC
[2025-01-03T15:50:59Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061".
[2025-01-03T15:50:59Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767".
[2025-01-03T15:50:59Z INFO service::utils::clean] Find directory "pg_vectors/indexes/283061/segments/0717f022-89c3-4f1a-87b5-bc1b90def723".
[2025-01-03T15:51:02Z INFO service::utils::clean] Find directory "pg_vectors/indexes/400767/segments/9344fd82-ade5-4285-b69d-84b3de4c9d57".
2025-01-03 15:51:03.818 UTC [27] LOG: database system was not properly shut down; automatic recovery in progress
2025-01-03 15:51:03.848 UTC [27] LOG: redo starts at 7/2DF52400
2025-01-03 15:51:03.848 UTC [27] LOG: invalid record length at 7/2DF524E8: wanted 24, got 0
2025-01-03 15:51:03.848 UTC [27] LOG: redo done at 7/2DF524B0 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2025-01-03 15:51:04.040 UTC [1] LOG: database system is ready to accept connections
Zeus
Zeusβ€’4mo ago
Your database is corrupted You should restore from backup
Protenix
ProtenixOPβ€’4mo ago
Ok Can i test my database backup to know if they are corrupted too (and which one) before restoring?
Zeus
Zeusβ€’4mo ago
You would have to restore each one to test
Protenix
ProtenixOPβ€’4mo ago
Ok I'll restore the db using the same immich version that I have already installed since it is the version that wrote the backup files, is it correct?
Zeus
Zeusβ€’4mo ago
Yep
Protenix
ProtenixOPβ€’4mo ago
Ok. I'm not sure about an instruction in the restore procedure. This is the windows procedure according to docs:
docker compose down -v # CAUTION! Deletes all Immich data to start from scratch
## Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database
# Remove-Item -Recurse -Force DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch
## You should mount the backup (as a volume, example: - 'C:\path\to\backup\dump.sql':/dump.sql) into the immich_postgres container using the docker-compose.yml
docker compose pull # Update to latest version of Immich (if desired)
docker compose create # Create Docker containers for Immich apps without running them
docker start immich_postgres # Start Postgres server
sleep 10 # Wait for Postgres server to start up
docker exec -it immich_postgres bash # Enter the Docker shell and run the following command
# Check the database user if you deviated from the default
cat "/dump.sql" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| psql --username=postgres # Restore Backup
exit # Exit the Docker shell
docker compose up -d # Start remainder of Immich apps
docker compose down -v # CAUTION! Deletes all Immich data to start from scratch
## Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database
# Remove-Item -Recurse -Force DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch
## You should mount the backup (as a volume, example: - 'C:\path\to\backup\dump.sql':/dump.sql) into the immich_postgres container using the docker-compose.yml
docker compose pull # Update to latest version of Immich (if desired)
docker compose create # Create Docker containers for Immich apps without running them
docker start immich_postgres # Start Postgres server
sleep 10 # Wait for Postgres server to start up
docker exec -it immich_postgres bash # Enter the Docker shell and run the following command
# Check the database user if you deviated from the default
cat "/dump.sql" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| psql --username=postgres # Restore Backup
exit # Exit the Docker shell
docker compose up -d # Start remainder of Immich apps
I'm not sure on how should I do the instruction line
## You should mount the backup (as a volume, example: - 'C:\path\to\backup\dump.sql':/dump.sql) into the immich_postgres container using the docker-compose.yml
## You should mount the backup (as a volume, example: - 'C:\path\to\backup\dump.sql':/dump.sql) into the immich_postgres container using the docker-compose.yml
How should I edit my docker-compose.yml? How do I mount the backup as volume in the immich_postgres container?
Zeus
Zeusβ€’4mo ago
Youll have to mount that file under immich_postgres Fair warning the restore on windows can be pretty challenging
Protenix
ProtenixOPβ€’4mo ago
I'm not sure how to do that in docker desktop Is there anyone who has done this and could help me with this?
Zeus
Zeusβ€’4mo ago
Not sure, in our docs we recommend using windows. I would recommend doing some google searches and read up on docker desktop Basically you need to add that file as a mount next to the DB_DATA_LOCATION:/var/lib/postgresql line
Protenix
ProtenixOPβ€’4mo ago
I'm using docker desktop on windows (The docker compose was the recommended installation on docs)
Zeus
Zeusβ€’4mo ago
https://immich.app/docs/install/requirements/ "Non-Linux OSes tend to provide a poor Docker experience and are strongly discouraged. Our ability to assist with setup or troubleshooting on non-Linux OSes will be severely reduced. If you still want to try to use a non-Linux OS, you can set it up as follows:"
Protenix
ProtenixOPβ€’4mo ago
(ok sorry, you wrote "we recommend using windows")
Zeus
Zeusβ€’4mo ago
Oh my bad i meant to write against. Sorry
Protenix
ProtenixOPβ€’4mo ago
Ok wait this makes sense, i've read it better Ok I did as described in the restore procedure However this error occurred:
docker exec -it immich_postgres bash
root@61847bad9476:/# cat "/backup1734746400013.sql" \
> | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
> | psql --username=postgres
SET
SET
SET
DROP DATABASE
ERROR: current user cannot be dropped
ERROR: role "postgres" already exists
ALTER ROLE
SET
SET
SET
ERROR: unrecognized configuration parameter "transaction_timeout"
SET
SET
set_config
--------------------
public, pg_catalog
(1 row)

SET
SET
SET
SET
UPDATE 1
DROP DATABASE
ERROR: option "locale_provider" not recognized
LINE 1: ...late1 WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PRO...
^
ERROR: database "template1" does not exist
\connect: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "template1" does not exist
docker exec -it immich_postgres bash
root@61847bad9476:/# cat "/backup1734746400013.sql" \
> | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
> | psql --username=postgres
SET
SET
SET
DROP DATABASE
ERROR: current user cannot be dropped
ERROR: role "postgres" already exists
ALTER ROLE
SET
SET
SET
ERROR: unrecognized configuration parameter "transaction_timeout"
SET
SET
set_config
--------------------
public, pg_catalog
(1 row)

SET
SET
SET
SET
UPDATE 1
DROP DATABASE
ERROR: option "locale_provider" not recognized
LINE 1: ...late1 WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PRO...
^
ERROR: database "template1" does not exist
\connect: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "template1" does not exist
I will try with the other backups
Zeus
Zeusβ€’4mo ago
How did you make your backup? It doesn’t match the Postgres version
Protenix
ProtenixOPβ€’4mo ago
It is the automatic backup, but I started using the oldest one
Zeus
Zeusβ€’4mo ago
Please post your docker compose
Protenix
ProtenixOPβ€’4mo ago
This same problem happens with the other backups
Zeus
Zeusβ€’4mo ago
can you show me what folder you found the backup in, and what folders are next to that folder?
Protenix
ProtenixOPβ€’4mo ago
No description
Protenix
ProtenixOPβ€’4mo ago
No description
Zeus
Zeusβ€’4mo ago
and you haven't edited your compose at all, or changes postgres versions? hang on, that's not the file you are using ?? I:\backup\library\backups\backup1735092000006.sql is not the screenshot you showed me
Protenix
ProtenixOPβ€’4mo ago
I haven't changed compose except to mount the backup, and I don't even know how to change postgres version
Zeus
Zeusβ€’4mo ago
Youre not using the right backup Please compare the path from the compose to the screenshot
Protenix
ProtenixOPβ€’4mo ago
the file i'm using for backup is the .sql file extracted from the .gz, renamed to avoid the "-" character
Zeus
Zeusβ€’4mo ago
Ahhhhh ok. Can you show how you created it to confirm
Protenix
ProtenixOPβ€’4mo ago
I first copied the entire immich folder (including the filesystem) to be able to undo any changes. Then I opened any .gz file and extracted the .sql file inside (it has the same name as the .gz file). Finally I renamed the file to remove the "-" character and make testing easier. I did the same things with the other backup files.
Zeus
Zeusβ€’4mo ago
You might have to edit the dump SQL file to remove LOCALE_PROVIDER and TRANSACTION_TIMEOUT
Protenix
ProtenixOPβ€’4mo ago
Do you mean to use a text editor to edit the sql file? The template1 problem would still remain, I think. I'll try tomorrow
Zeus
Zeusβ€’4mo ago
The template1 will be created if those earlier commands dont error out
Protenix
ProtenixOPβ€’4mo ago
Ok, I'll try
Zeus
Zeusβ€’4mo ago
I might ask you to open an issue on github Can you confirm youve never edited the docker compose since first setup? Until now Can you post your env as well here
Protenix
ProtenixOPβ€’4mo ago
Yes I never opened an issue on github but I will once the problem will be clear I'll post my .env tomorrow, but i don't think It will help (iirc I just set the version of immich to use to avoid update problems)
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=pgdata

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Europe/Rome

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

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=sellercloud

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=pgdata

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Europe/Rome

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

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=sellercloud

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
bo0tzz
bo0tzzβ€’4mo ago
In our first version of the automatic db dumps, we used pg_dump version 17 and trying to restore that into a pg 14 database causes these errors You can try upping the postgres image to 16 (there is no 17 with vecto.rs 0.3.0), if that doesn't work then just deleting the broken lines from the SQL should get you there
Protenix
ProtenixOPβ€’4mo ago
I tried the second thing you suggested because Zeus suggested it yesterday The backup restore went significantly ahead for a while, but in the end the main error remains (log attached)
Protenix
ProtenixOPβ€’4mo ago
This is what I do:
bo0tzz
bo0tzzβ€’4mo ago
Did you also try removing that LOCALE_PROVIDER option?
Protenix
ProtenixOPβ€’4mo ago
Yes
PS I:\immich-core> docker compose down -v
[+] Running 7/7
βœ” Container immich_machine_learning Removed 0.2s
βœ” Container immich_server Removed 0.2s
βœ” Container immich_postgres Removed 0.3s
βœ” Container immich_redis Removed 0.3s
βœ” Volume immich_pgdata Removed 0.2s
βœ” Volume immich_model-cache Removed 0.2s
βœ” Network immich_default Removed 0.3s

PS I:\immich-core> Remove-Item -Recurse -Force pgdata
Remove-Item : Impossibile trovare il percorso 'I:\immich-core\pgdata' perchΓ© non esiste.
In riga:1 car:1
+ Remove-Item -Recurse -Force pgdata
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (I:\immich-core\pgdata:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
PS I:\immich-core> docker compose down -v
[+] Running 7/7
βœ” Container immich_machine_learning Removed 0.2s
βœ” Container immich_server Removed 0.2s
βœ” Container immich_postgres Removed 0.3s
βœ” Container immich_redis Removed 0.3s
βœ” Volume immich_pgdata Removed 0.2s
βœ” Volume immich_model-cache Removed 0.2s
βœ” Network immich_default Removed 0.3s

PS I:\immich-core> Remove-Item -Recurse -Force pgdata
Remove-Item : Impossibile trovare il percorso 'I:\immich-core\pgdata' perchΓ© non esiste.
In riga:1 car:1
+ Remove-Item -Recurse -Force pgdata
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (I:\immich-core\pgdata:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
PS I:\immich-core> docker compose create
[+] Creating 7/7
βœ” Network immich_default Created 0.1s
βœ” Volume "immich_model-cache" Created 0.0s
βœ” Volume "immich_pgdata" Created 0.0s
βœ” Container immich_redis Created 1.2s
βœ” Container immich_postgres Created 1.2s
βœ” Container immich_machine_learning Created 1.1s
βœ” Container immich_server Created 0.6s
PS I:\immich-core> docker start immich_postgres
immich_postgres

PS I:\immich-core> docker exec -it immich_postgres bash
root@61847bad9476:/# cat "/backup.sql" \
> | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
> | psql --username=postgres
PS I:\immich-core> docker compose create
[+] Creating 7/7
βœ” Network immich_default Created 0.1s
βœ” Volume "immich_model-cache" Created 0.0s
βœ” Volume "immich_pgdata" Created 0.0s
βœ” Container immich_redis Created 1.2s
βœ” Container immich_postgres Created 1.2s
βœ” Container immich_machine_learning Created 1.1s
βœ” Container immich_server Created 0.6s
PS I:\immich-core> docker start immich_postgres
immich_postgres

PS I:\immich-core> docker exec -it immich_postgres bash
root@61847bad9476:/# cat "/backup.sql" \
> | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
> | psql --username=postgres
This line "Remove-Item -Recurse -Force pgdata" it's useless If I understand what it is for, it should delete var/lib/pgsql/data which is already deleted by doing compose down, deleting postgres container There is no "pgdata" in the immich folder I'm sorry there was another "LOCALE_PROVIDER" I did not see Just a sec Ok it restored the backup correctly πŸŽ‰ Does this means that the database is healty?
docker exec -it immich_postgres psql --dbname=immich --username=postgres --command="SELECT datname, checksum_failures, checksum_last_failure FROM pg_stat_database WHERE datname IS NOT NULL"
datname | checksum_failures | checksum_last_failure
-----------+-------------------+-----------------------
template0 | 0 |
template1 | 0 |
immich | 0 |
postgres | 0 |
(4 rows)
docker exec -it immich_postgres psql --dbname=immich --username=postgres --command="SELECT datname, checksum_failures, checksum_last_failure FROM pg_stat_database WHERE datname IS NOT NULL"
datname | checksum_failures | checksum_last_failure
-----------+-------------------+-----------------------
template0 | 0 |
template1 | 0 |
immich | 0 |
postgres | 0 |
(4 rows)
Zeus
Zeusβ€’4mo ago
If it restored and immich is working normally it’s likely everything is fine yep! Can you try running this command? docker exec -it immich_postgres pg_amcheck --username=postgres --heapallindexed --parent-check --rootdescend --progress --all --install-missing
Protenix
ProtenixOPβ€’4mo ago
What will it do?
Zeus
Zeusβ€’4mo ago
check for errors
Protenix
ProtenixOPβ€’4mo ago
I'm still figuring out which backup to restore, can I try it to determine the best (healty and more recent) backup or should I wait to run it after I choose it?
Zeus
Zeusβ€’4mo ago
if it reports normal it means the backup is healthy, but you still have to restore it first it's similar to the checksum failures you did, just an additional test
Protenix
ProtenixOPβ€’4mo ago
Ok I was wandering what --install-missing does since I don't want to modify immich installation on docker before choosing the best backup
Zeus
Zeusβ€’4mo ago
it's a database extension, not the immich files
Protenix
ProtenixOPβ€’4mo ago
Running 944/944 relations (100%), 175546/175546 pages (100%) This is all it says
Zeus
Zeusβ€’4mo ago
that's normal
Protenix
ProtenixOPβ€’4mo ago
Ok perfect I'll try to restore different backups starting from the most recent, the first one healty i find i'll keep it How should I create the issue on github? Which problem do you want me to report? Different db version between backup and live db?
Zeus
Zeusβ€’4mo ago
this was fixed in 1.121 or 122 you are on 120, I didn't realize either way if you delete those few words it won't affect your data. just annoying
Protenix
ProtenixOPβ€’4mo ago
Okok I have a question: what about the files that are in the filesystem but there are not in the restored database? What will happen when I try to upload them?
Zeus
Zeusβ€’4mo ago
you can use the repair page (immichurl.com/admin/repair) to find the untracked files, the manually re upload you will have to carefully move them out of the immich library and reupload using the website don't reupload the thumbnails just the original image
Protenix
ProtenixOPβ€’4mo ago
what happens if i don't remove them but just try to upload them?
Zeus
Zeusβ€’4mo ago
not a big deal, you will just have some extra files in the library that aren't u sed by immich
Protenix
ProtenixOPβ€’4mo ago
Okok I was asking because I have some automatic backups on immich of some smartphones and they could reload them before I managed to clean the old ones
Zeus
Zeusβ€’4mo ago
not a big deal

Did you find this page helpful?