I
Immich3w ago
Wibias

Restore Borg Backup + Swap from immich LXC to Docker

Hey, so i messed up some stuff, but luckily had a borg backup. So i mounted and then extracted that. Since after i messed up I also swapped from immich LXC to alpine linux docker lxc there are no real useful logs. I basically extracted it and then moved everything from the extract to ./~library where I can see it. But my immich instance doesnt seem to recognize it nor do anything with it. Having to create a new account not seeing photos etc. I guess the reason is the rights. Normally its drwxr-xr-x 2 root root but after extracting the backup and then rsync it to the folder its get set to -rw------- 1 999 996 So anything I can do about that? Or a known workaround? Tbh I tried it the last two days myself, but I cant get a solution for that.. I guess thats a Borg thing? But I cant seem to figure it out at all.. Would appreciate any hints.
14 Replies
Immich
Immich3w ago
:wave: Hey @Wibias, 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. Successfully submitted, a tag has been added to inform contributors. :white_check_mark:
Wibias
WibiasOP3w ago
Okay, now i am out of luck. I managed to get it to the directory with root:root and the rwxr-xr-x rights. Still. Nothing. Not sure in which direction I can go now expect just uploading everything manually.. But since its already all in folders from the storage-template.. alpine-docker:~/immich-app/library/backups# ls -All total 331743 -rwxr-xr-x 1 root root 13 Sep 16 23:20 .immich -rwxr-xr-x 1 root root 16537835 Sep 12 00:00 immich-db-backup-20250912T020000-v1.141.1-pg16.10.sql.gz -rwxr-xr-x 1 root root 110473117 Sep 13 00:00 immich-db-backup-20250913T020000-v1.141.1-pg16.10.sql.gz -rwxr-xr-x 1 root root 111308925 Sep 14 00:00 immich-db-backup-20250914T020000-v1.141.1-pg16.10.sql.gz -rwxr-xr-x 1 root root 101061037 Sep 15 00:00 immich-db-backup-20250915T020000-v1.142.0-pg16.10.sql.gz
Zeus
Zeus3w ago
You need to restore the database
Wibias
WibiasOP3w ago
So you mean basically doing this: docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=<DB_USERNAME> | gzip > "/path/to/backup/dump.sql.gz" With the newest immich-db-backup-2025[...].sql.gz file? But that is not possible? I can't dump anything out of immich_postgres because it was running on an immich lxc before not on docker?
Zeus
Zeus3w ago
If the paths don’t match you’d probably have to manually edit the database, yes We don’t support the LXC install script It might auto detect it the migration if you start it up since the immich_media_location has changed. Not sure
Mraedis
Mraedis3w ago
For the LXC you just skip the docker exec -t immich_postgres part
Wibias
WibiasOP3w ago
So also when I switched away from lxc immich to now docker Linux alpine lxc? Just the part below?
Mraedis
Mraedis3w ago
No, the docker exec -t immich_postgres executes the command inside the postgres container. When you run the LXC it's not running any container you so you skip that part, when you are doing compose you are
Wibias
WibiasOP3w ago
Yea i get that, but what I dont get is how to change that to the now running docker lxc container. I have in /immich-app/library/backups the old db backups from immich itself. When trying this:
gunzip -c /root/immich-app/library/backups/immich-db-backup-20250912T020000-v1.141.1-pg16.10.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 -U postgres
gunzip -c /root/immich-app/library/backups/immich-db-backup-20250912T020000-v1.141.1-pg16.10.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 -U postgres
I get this:
SET
SET
DROP DATABASE
NOTICE: role "immich" does not exist, skipping
DROP ROLE
ERROR: current user cannot be dropped
CREATE ROLE
ALTER ROLE
ERROR: role "postgres" already exists
ALTER ROLE
SET
SET
SET
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
sed: write error
gunzip: write: Broken pipe
SET
SET
DROP DATABASE
NOTICE: role "immich" does not exist, skipping
DROP ROLE
ERROR: current user cannot be dropped
CREATE ROLE
ALTER ROLE
ERROR: role "postgres" already exists
ALTER ROLE
SET
SET
SET
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
sed: write error
gunzip: write: Broken pipe
Zeus
Zeus3w ago
You’ll need to restore into PG 16 since that’s what you made the backup with
Wibias
WibiasOP3w ago
Okay it worked now with ghcr.io/immich-app/postgres:16-vectorchord0.4.3-pgvectors0.2.0 That worked so all settings and stuff is back. But I still dont see the photos. The photos are defenitly there. Just tried by moving a new photo in an existing folder. The new photo can be seen in immich, the old one not. Both have the same rights/owner. alpine-docker:~/immich-app/library/library/admin/2023/April/03# ls -All total 9447 -rw-r--r-- 1 root root 5693563 Sep 12 11:11 20230403_182755.jpg -rw-r--r-- 1 root root 695 Sep 12 11:57 20230403_182755.jpg.xmp -rw-r--r-- 1 root root 366963 Sep 12 11:13 IMG-20230403-WA0009.jpg -rw-r--r-- 1 root root 588 Sep 12 11:58 IMG-20230403-WA0009.jpg.xmp -rw-r--r-- 1 root root 3583594 Jul 8 17:29 collage-phone-bg.jpg -rw-r--r-- 1 root root 586 Sep 17 15:30 collage-phone-bg.jpg.xmp Collage-phone can be seen. The other not. I guess that has something to do with the database expecting the images somewhere else?
Mraedis
Mraedis3w ago
Is the GUI empty or does it show error thumbnails? If it's empty, the restore didn't work If it's showing error thumbnails then yes the media location probably is wrong
Wibias
WibiasOP3w ago
Its empty..

Did you find this page helpful?