I
Immich3mo ago
Joe.

Pi died and failing to transfer to new device

Yesterday my PI died (lost /immich-app, .env docker-compose.yml and /postgres) so have plugged the mass storage drive into a new machine (not a PI) I have tried restoring an automatic backup using the guide on the docs (backup and restore), I have setup the .env file again to point at the drive but when I go to the web app, all come up with "Error loading image" and only shows this from January this year. Checking the logs it looks like it is searching for a different UUID (268b...) but the files saved on my drive are under 69121... so is coming up file not found. Where would I change this or is there a fix? New machine is a Dell Optiplex 7050 running Ubuntu 24.04.2 LTS, drive is mounted to the same directory as on the Pi, immich version 1.126.1
50 Replies
Immich
Immich3mo ago
:wave: Hey @Joe., 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. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time). 2. :ballot_box_with_check: read applicable release notes. 3. :ballot_box_with_check: reviewed the FAQs for known issues. 4. :ballot_box_with_check: reviewed Github for known issues. 5. :ballot_box_with_check: tried accessing Immich via local ip (without a custom reverse proxy). 6. :ballot_box_with_check: uploaded the relevant information (see below). 7. :ballot_box_with_check: 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.
Immich
Immich3mo ago
Successfully submitted, a tag has been added to inform contributors. :white_check_mark:
Tempest
Tempest3mo ago
Which directories did you all restore? If you zoom in on an image or download it, can you see it then?
Joe.
Joe.OP2mo ago
Not sure what you mean but I moved the same drive from the Pi to the new machine, mounted it on the same location as it was, pulled the two files, and restored the most recent backup from /upload/backups using the manual restore from https://immich.app/docs/administration/backup-and-restore/ no if I download it give the notification it is downloading but then nothing happens or zoom in its still the Error loading image Anyone got any thoughts?
Zeus
Zeus2mo ago
You haven’t shared much of anything at all about what you did, logs, anything You need to include wayyy more info if you want us to know what’s going on Directory structure of all relevant folders Database restore output
Joe.
Joe.OP2mo ago
The logs are above, my processes are in the original message
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
# rm -rf DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch
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
# Check the database user if you deviated from the default
gunzip < "/path/to/backup/dump.sql.gz" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| docker exec -i immich_postgres psql --dbname=postgres --username=<DB_USERNAME> # Restore Backup
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
# rm -rf DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch
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
# Check the database user if you deviated from the default
gunzip < "/path/to/backup/dump.sql.gz" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| docker exec -i immich_postgres psql --dbname=postgres --username=<DB_USERNAME> # Restore Backup
docker compose up -d # Start remainder of Immich apps
Joe.
Joe.OP2mo ago
/mnt/4tb/Pictures/
└── immich_root
├── postgres
└── upload
├── backups
│   ├── immich-db-backup-1738720800013.sql.gz
│   ├── immich-db-backup-1738807200018.sql.gz
│   ├── immich-db-backup-1738893600014.sql.gz
│   ├── immich-db-backup-1738980000012.sql.gz
│   ├── immich-db-backup-1739757600014.sql.gz
│   ├── immich-db-backup-1739844000014.sql.gz
│   ├── immich-db-backup-1739930400012.sql.gz
│   ├── immich-db-backup-1740016800040.sql.gz
│   ├── immich-db-backup-1740103200017.sql.gz
│   ├── immich-db-backup-1740189600038.sql.gz
│   ├── immich-db-backup-1740276000009.sql.gz
│   ├── immich-db-backup-1740362400005.sql.gz
│   ├── immich-db-backup-1740448800004.sql.gz
│   └── immich-db-backup-1740535200004.sql.gz
├── encoded-video
│   └── 69121b7b-6ee6-4f7c-bc31-aad2ba8d549f
├── library
├── profile
├── thumbs
│   └── 69121b7b-6ee6-4f7c-bc31-aad2ba8d549f
└── upload
└── 69121b7b-6ee6-4f7c-bc31-aad2ba8d549f

13 directories, 14 files
/mnt/4tb/Pictures/
└── immich_root
├── postgres
└── upload
├── backups
│   ├── immich-db-backup-1738720800013.sql.gz
│   ├── immich-db-backup-1738807200018.sql.gz
│   ├── immich-db-backup-1738893600014.sql.gz
│   ├── immich-db-backup-1738980000012.sql.gz
│   ├── immich-db-backup-1739757600014.sql.gz
│   ├── immich-db-backup-1739844000014.sql.gz
│   ├── immich-db-backup-1739930400012.sql.gz
│   ├── immich-db-backup-1740016800040.sql.gz
│   ├── immich-db-backup-1740103200017.sql.gz
│   ├── immich-db-backup-1740189600038.sql.gz
│   ├── immich-db-backup-1740276000009.sql.gz
│   ├── immich-db-backup-1740362400005.sql.gz
│   ├── immich-db-backup-1740448800004.sql.gz
│   └── immich-db-backup-1740535200004.sql.gz
├── encoded-video
│   └── 69121b7b-6ee6-4f7c-bc31-aad2ba8d549f
├── library
├── profile
├── thumbs
│   └── 69121b7b-6ee6-4f7c-bc31-aad2ba8d549f
└── upload
└── 69121b7b-6ee6-4f7c-bc31-aad2ba8d549f

13 directories, 14 files
immich-app/
├── docker-compose.yml
└── postgres [error opening dir]

2 directories, 1 file
immich-app/
├── docker-compose.yml
└── postgres [error opening dir]

2 directories, 1 file
I have since tried changing the UUID from 69121xxx to 268b52xxx and i still get the same error
Joe.
Joe.OP2mo ago
No description
Joe.
Joe.OP2mo ago
also the timeline only goes back to 27th Jan 2025 should be going back to about 2007
Zeus
Zeus2mo ago
You can’t change the UUID I see two different Postgres folders
Joe.
Joe.OP2mo ago
it looks like in the logs its looking for a different UUID to the one its been stored
Zeus
Zeus2mo ago
Most likely because you haven’t properly restored the database It won’t just randomly change the UUID I don't see any actual database output from the restore You haven't included the actual command that you ran for the restore, you just pasted form the docs we need to see the exact ones you ran
Joe.
Joe.OP2mo ago
. the first section in the message is what i ran
Zeus
Zeus2mo ago
ok well there's tons of stuff wrong with that then did you read the comments explaining to set the path for the dump to your location, and set DB_USERNAME ..? /path/to/backup/dump.sql.gz this would be set to the path to your backup <DB_USERNAME> this would be set to the DB_USERNAME from your env You also need to uncomment the rm line and point it to the existing DB_DATA_LOCATION (not the backup dumps)
Joe.
Joe.OP2mo ago
oh its not copied properly, just what I had copied from the site not what i actually ran, yes I have updated all of these
Zeus
Zeus2mo ago
^ You haven’t updated it correctly because no restore actually took place based on the output you posted There should be a ton of output from Postgres during a restore example:
SET
SET
SET
DROP DATABASE
ERROR: current user cannot be dropped
ERROR: role "postgres" already exists
ALTER ROLE
SET
SET
SET
SET
SET
set_config
--------------------
public, pg_catalog
(1 row)

SET
SET
SET
SET
SET
SET
SET
DROP DATABASE
ERROR: current user cannot be dropped
ERROR: role "postgres" already exists
ALTER ROLE
SET
SET
SET
SET
SET
set_config
--------------------
public, pg_catalog
(1 row)

SET
SET
SET
SET
but way longer
Joe.
Joe.OP2mo ago
any issues you see with this?
No description
Zeus
Zeus2mo ago
can you run head -n 10 /mnt/4tb/Pictures...sql.gz copy paste it from the command to make sure it's correct can you also run ls -lh /mnt/4tb/Pictures..../backups just fill in the ...
Joe.
Joe.OP2mo ago
1 sec
Zeus
Zeus2mo ago
oh wait you'll have go do gunzip < ...sql.gz | head
Joe.
Joe.OP2mo ago
total 964M
-rwxrwxrwx 1 root root 91M Feb 5 02:00 immich-db-backup-1738720800013.sql.gz
-rwxrwxrwx 1 root root 91M Feb 6 02:00 immich-db-backup-1738807200018.sql.gz
-rwxrwxrwx 1 root root 91M Feb 7 02:00 immich-db-backup-1738893600014.sql.gz
-rwxrwxrwx 1 root root 91M Feb 8 02:00 immich-db-backup-1738980000012.sql.gz
-rwxrwxrwx 1 root root 91M Feb 17 02:00 immich-db-backup-1739757600014.sql.gz
-rwxrwxrwx 1 root root 91M Feb 18 02:00 immich-db-backup-1739844000014.sql.gz
-rwxrwxrwx 1 root root 91M Feb 19 02:00 immich-db-backup-1739930400012.sql.gz
-rwxrwxrwx 1 root root 91M Feb 20 02:01 immich-db-backup-1740016800040.sql.gz
-rwxrwxrwx 1 root root 91M Feb 21 02:00 immich-db-backup-1740103200017.sql.gz
-rwxrwxrwx 1 root root 91M Feb 22 02:00 immich-db-backup-1740189600038.sql.gz
-rwxrwxrwx 1 root root 15M Feb 23 02:00 immich-db-backup-1740276000009.sql.gz
-rwxrwxrwx 1 root root 15M Feb 24 02:00 immich-db-backup-1740362400005.sql.gz
-rwxrwxrwx 1 root root 15M Feb 25 02:00 immich-db-backup-1740448800004.sql.gz
-rwxrwxrwx 1 root root 15M Feb 26 02:00 immich-db-backup-1740535200004.sql.gz
total 964M
-rwxrwxrwx 1 root root 91M Feb 5 02:00 immich-db-backup-1738720800013.sql.gz
-rwxrwxrwx 1 root root 91M Feb 6 02:00 immich-db-backup-1738807200018.sql.gz
-rwxrwxrwx 1 root root 91M Feb 7 02:00 immich-db-backup-1738893600014.sql.gz
-rwxrwxrwx 1 root root 91M Feb 8 02:00 immich-db-backup-1738980000012.sql.gz
-rwxrwxrwx 1 root root 91M Feb 17 02:00 immich-db-backup-1739757600014.sql.gz
-rwxrwxrwx 1 root root 91M Feb 18 02:00 immich-db-backup-1739844000014.sql.gz
-rwxrwxrwx 1 root root 91M Feb 19 02:00 immich-db-backup-1739930400012.sql.gz
-rwxrwxrwx 1 root root 91M Feb 20 02:01 immich-db-backup-1740016800040.sql.gz
-rwxrwxrwx 1 root root 91M Feb 21 02:00 immich-db-backup-1740103200017.sql.gz
-rwxrwxrwx 1 root root 91M Feb 22 02:00 immich-db-backup-1740189600038.sql.gz
-rwxrwxrwx 1 root root 15M Feb 23 02:00 immich-db-backup-1740276000009.sql.gz
-rwxrwxrwx 1 root root 15M Feb 24 02:00 immich-db-backup-1740362400005.sql.gz
-rwxrwxrwx 1 root root 15M Feb 25 02:00 immich-db-backup-1740448800004.sql.gz
-rwxrwxrwx 1 root root 15M Feb 26 02:00 immich-db-backup-1740535200004.sql.gz
-- PostgreSQL database cluster dump
--

SET default_transaction_read_only = off;

SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;

--
-- PostgreSQL database cluster dump
--

SET default_transaction_read_only = off;

SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;

--
other way round but yeah
Zeus
Zeus2mo ago
Weird Try the restore one line at a time and try the docker exec again. Stop after that (don’t start the full stack) Why did your DB get so much smaller on Feb 20?
Joe.
Joe.OP2mo ago
thats when my pi died the rest after are just the auto backups on the new machine so everything up to the sleep from the docs?
Zeus
Zeus2mo ago
Oh ok you’re using the bigger one
Joe.
Joe.OP2mo ago
yep done, container immich_postgres healthy
Zeus
Zeus2mo ago
Now run the gunzip command but remove the docker exec part Let’s see what it prints
Joe.
Joe.OP2mo ago
No description
Joe.
Joe.OP2mo ago
thats the last bit
gunzip < "/mnt/4tb/Pictures/immich_root/upload/backups/immich-db-backup-1740189600038.sql.gz"
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g"
gunzip < "/mnt/4tb/Pictures/immich_root/upload/backups/immich-db-backup-1740189600038.sql.gz"
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g"
Zeus
Zeus2mo ago
There’s no data in that backup. You used the 00038 file
Joe.
Joe.OP2mo ago
thats the last 91M one -rwxrwxrwx 1 root root 91M Feb 22 02:00 immich-db-backup-1740189600038.sql.gz
Zeus
Zeus2mo ago
Try just gunzip with no sed I guess , also test an earlier backup please
Joe.
Joe.OP2mo ago
gunzip < "/mnt/4tb/Pictures/immich_root/upload/backups/immich-db-backup-1740016800040.sql.gz"
gunzip < "/mnt/4tb/Pictures/immich_root/upload/backups/immich-db-backup-1740016800040.sql.gz"
what do you need from the output?
Joe.
Joe.OP2mo ago
No description
Joe.
Joe.OP2mo ago
backup from 20th feb
Zeus
Zeus2mo ago
How many lines is the full output?
Joe.
Joe.OP2mo ago
365108
Zeus
Zeus2mo ago
Huh. I thought it always dropped the Postgres database first Ok try doing the full command from the docs and see what the output is
Joe.
Joe.OP2mo ago
with exec or just sed?
Zeus
Zeus2mo ago
With exec
Joe.
Joe.OP2mo ago
No description
Joe.
Joe.OP2mo ago
looking promising
Zeus
Zeus2mo ago
It would be good to see the full output uploaded I don’t see any rows created
Joe.
Joe.OP2mo ago
can i re-run or will have to rm the database?
Zeus
Zeus2mo ago
You can’t re run but if you can scroll there should be some INSERT or COPY lines Or you can start over
Joe.
Joe.OP2mo ago
No description
Zeus
Zeus2mo ago
Oh yeah Most likely you mis typed the file name when restoring from gunzip Before
Joe.
Joe.OP2mo ago
god damn dyslexia, its all back now 🙂 thank you
Zeus
Zeus2mo ago
Tab autocomplete is your friend 🙂 Glad to hear it
Joe.
Joe.OP2mo ago
when its those short ones like mnt i just type them, has often been my downfall lol

Did you find this page helpful?