#I still have my database in the postgres folder but when I launch immich, it asks me to create admin

1 messages · Page 1 of 1 (latest)

warped fog
#

I tried to secure access via https using certbot. In that process I added a cert and then modified the .yml. The data is still intact and it looks like the files within the postgress folder are still there, with the expected dates on them. Can I get back to what I had?

I backed up the .yml file before doing anything. When I restore that, it asks me to create an admin account.

I need help, please.

wanton palmBOT
#

:wave: Hey @warped fog,

Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich immich.

References

Checklist

  1. :ballot_box_with_check: I have verified I'm on the latest release(note that mobile app releases may take some time).
  2. :ballot_box_with_check: I have read applicable release notes.
  3. :ballot_box_with_check: I have reviewed the FAQs for known issues.
  4. :ballot_box_with_check: I have reviewed Github for known issues.
  5. :ballot_box_with_check: I have tried accessing Immich via local ip (without a custom reverse proxy).
  6. :ballot_box_with_check: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting.
  7. :ballot_box_with_check: I have 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)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

wanton palmBOT
warped fog
white bear
#

Did you also modify your .env?

#

what is the output of docker volume ls?

warped fog
warped fog
# white bear what is the output of `docker volume ls`?

Here is the output:

~/immich-app# docker volume ls
DRIVER    VOLUME NAME
local     1edfb986df8fd05dbdb2ccde2b180d0150b9fa6245c62518c9797355c6a552a5
local     2ef810130513e7d19b9f17d22e8923a5e24d5427236ae7977369269fa24a0568
local     4a452b2b380fa06d58112bc74d968ff0e87651e2dd61f3db1298bc8ebb02ed70
local     96d13ae46488fc3d7f68e3f314adfacbe43226a3cca4506abd3631820c680947
local     b8de2949d5877964bf2107da824787fa754390ca4acf36285d1f622d429381c8
local     bc8473cec7c6f9b456532356a9dc90ff354c58b43b97c123af71ee5fd2a616b7
local     e05665e623d7b72a61b9340eea64c5b5b736794e3f13c4decceb8a0580bbd78b
local     immich_model-cache
white bear
#

so looks like you database is at ./postgres relative to the docker-compose.yml file'

#

have you made any backup of this database?

warped fog
white bear
#

Do you know what have you changed in the docker-compose.yml file?

warped fog
white bear
#

yes please, that would be helpful

warped fog
#

original

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
#

attempt

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      # Mount SSL certificate and key from Certbot
      - /etc/letsencrypt/live/photos.nacnud.com/fullchain.pem:/etc/letsencrypt/live/photos.nacnud.com/fullchain.pem:ro
      - /etc/letsencrypt/live/photos.nacnud.com/privkey.pem:/etc/letsencrypt/live/photos.nacnud.com/privkey.pem:ro
      - /etc/letsencrypt/options-ssl-nginx.conf:/etc/letsencrypt/options-ssl-nginx.conf:ro
    env_file:
      - .env
    ports:
      - 443:443  # HTTPS port
      - 2283:3001  # Additional Immich port if needed
#

I reverted back to the original when the attempt didn't work.

white bear
#

I don't see why the database would be reset on this one

#

Do you have any client that you can access to the database?

warped fog
white bear
#

or attaching to the database?

warped fog
#

Here's the contents of the postgres folder:

root@DietPi:~/immich-app/postgres# ls -al
total 148
drwx------ 21  999 root             4096 Sep 11 05:32 .
drwxr-xr-x  4 root root             4096 Sep 11 05:32 ..
-rw-------  1  999 systemd-journal     3 Sep  9 01:09 PG_VERSION
drwx------  6  999 systemd-journal  4096 Sep  9 01:09 base
-rw-------  1  999 systemd-journal    44 Sep 11 05:32 current_logfiles
drwx------  2  999 systemd-journal  4096 Sep 11 05:33 global
drwx------  2  999 systemd-journal  4096 Sep 11 05:32 log
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_commit_ts
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_dynshmem
-rw-------  1  999 systemd-journal  4821 Sep  9 01:09 pg_hba.conf
-rw-------  1  999 systemd-journal  1636 Sep  9 01:09 pg_ident.conf
drwx------  4  999 systemd-journal  4096 Sep 11 05:37 pg_logical
drwx------  4  999 systemd-journal  4096 Sep  9 01:09 pg_multixact
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_notify
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_replslot
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_serial
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_snapshots
drwx------  2  999 systemd-journal  4096 Sep 11 05:32 pg_stat
drwx------  2  999 systemd-journal  4096 Sep 11 06:07 pg_stat_tmp
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_subtrans
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_tblspc
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_twophase
drwx------  4  999 systemd-journal  4096 Sep  9 01:09 pg_vectors
drwx------  3  999 systemd-journal  4096 Sep  9 01:19 pg_wal
drwx------  2  999 systemd-journal  4096 Sep  9 01:09 pg_xact
-rw-------  1  999 systemd-journal    88 Sep  9 01:09 postgresql.auto.conf
-rw-------  1  999 systemd-journal 28835 Sep  9 01:09 postgresql.conf
-rw-------  1  999 systemd-journal   229 Sep 11 05:32 postmaster.opts
-rw-------  1  999 systemd-journal    94 Sep 11 05:32 postmaster.pid
warped fog
white bear
warped fog
white bear
#

can you try this to connecting to the database

warped fog
white bear
#

let's do some query to checkout a few things

warped fog
white bear
#

can you do select u.id from users u;

warped fog
#

Nothing there.

white bear
#

oh man

#

wth happened here

warped fog
#

If I need to recreate, I can. I've got the images. I expect trial and error as I test this. I'd love to not lose the db but I can start over.

white bear
#

I just don't understand why the database can be altered with your changes?

warped fog
#

First, thank you for caring. Second, for making such a great tool.

white bear
#

let me bring this up with the team

warped fog
#

What logs would be helpful?

white bear
#

in case there are something wrong from us

warped fog
white bear
#

can you share the logs just for documentation purposes?

warped fog
#

Sure. Where are they located?

white bear
#

and the systemy you are running on

warped fog
#

Running DietPi (OS) on Raspberry Pi 5.

white bear
#

the database is on the local disk, correct?

warped fog
white bear
#

Thanks

warped fog
#

Where are the logs located that you mentioned?

white bear
#

you can do docker compose up which will print out the logs of all the conatiners in real time

warped fog
white bear
#

I don’t see anything abnormal, unless there was something happened on the system. If you can think of any, please let us know. I also wonder if you can reproduce this

#

From stock settings to your custom settings

warped fog
white bear
#

Thanks Jeffrey

#

It will be helpful

rare cradle
#

Hey, is it possible the external drive where the DB is on wasn't properly mounted initially?

#

(I'm assuming it is properly mounted now as you could show the content of the postgres folder)

vapid stump
#

Can you give a rough timeline of:

  • when you installed immich
  • if you have done any immich upgrades
  • when you did the "attempt"
warped fog
warped fog
steep turret
#

Seems very likely this is related to the external storage in some way. Possibly unmounted etc

#

Postgres doesn’t just lose the entire DB

vapid stump
#

when was your "attempt" was that sometime after the 8th or after successfully migrating to the pi 5? did you ever successfully start up immich on the pi and see your existing photos, etc.?

vapid stump
#

changing what folder your docker-compose.yml file was in, especially relative to the postgres folder would create a new database. worth double checking you don't have another postgres/ folder somewhere else on the drive.

warped fog
vapid stump
#

Might be worth shutting everything down, plugging the ssd back in, and then starting up immich again.

warped fog
#

On my pi, I have an immich-app folder on the microsd card which is 916MB. (clearly the db is still there)
On the external SSD (where the images are stored) there is a postgres folder that is empty.

root@DietPi:/mnt/ssd/immich# ls
docker-compose.yml
encoded-video 19GB)
library (143GB)
postgres (empty)
thumbs (22GB)
upload (8.1GB)

root@DietPi:~/immich-app# ls
docker-compose.yml
docker-compose.yml.bak
docker-compose.yml.org
library
postgres (916MB)

(I don't know why I have it in two places, but I do). Think there might still be a chance to recover this?

vapid stump
#

you can probably run docker compose up in ~/immich-app and it will just work.

#

the problem is you are most likely running docker compose up in /mnt/ssd/immich

#

you can't just randomly copy files to different places, run the same command and expect things to work the same way.

warped fog
#

When I run docker-compose up in the immich-app folder, it works but doesn't connect to the existing db.

vapid stump
#

The docker-compose.yml has a reference to .env and that needs to exist in the same folder as docker-compose.yml.

.env has references to

UPLOAD_LOCATION=./library
DB_DATA_LOCATION=./postgres

Both of those are local paths, relative to the location of docker-compose.yml so the library and postgres folder needs to exist relative to that.

#

You should just change UPLOAD_LOCATION to /mnt/ssd/immich

warped fog
#
on ssd (immich folder)

.env
# 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=./postgres

# 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=Etc/UTC

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

# 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=postgres

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

-----

on pi (immich-app folder)

.env
# 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=./postgres

# 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=Etc/UTC

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

# 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=Y2NjNzQ2YT

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

I would just set UPLOAD_LOCATION to /mnt/ssd/immich and DB_LOCATION to ~/immich-app/postgres (but probably convert to full, absolute path)

steep turret
#

But actually please don’t run your DB on a micro SD😭

#

Not a today problem maybe

warped fog
warped fog
#

Thank you. Can I buy you a coffee, or more? Or just contribute to the project?

wanton palmBOT
vapid stump
#

😁

warped fog
#

Can I safely copy the db folder over to my ssd?

vapid stump
#

If the database container is not running

warped fog
#

cp -a postgres/ /mnt/ssd/

That says "failed to preserve ownership..."

steep turret
#

What’s the filesystem on the ssd?

warped fog
warped fog
steep turret
#

Ah. That won’t work

#

NTFS or FAT isn’t supported for Postgres
I recommend EXT4

warped fog