immich database shuts down immediately after a system reboot

hello, when i reboot my computer the immich server doesnt work until i restart the docker compose using docker-compose up -d although it is setup to autorestart unless stopped. In the logs i found that the immich database restarts as soon as the computer boots. I have linked a log of the database container from the start of the computer until the container stops itself. and this is a log file when i do a docker-compose up -d
immich_postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization
immich_postgres |
immich_postgres | 2025-01-19 15:52:08.367 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
immich_postgres | 2025-01-19 15:52:08.369 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
immich_postgres | 2025-01-19 15:52:08.370 UTC [1] LOG: could not create IPv6 socket for address "::": Address family not supported by protocol
immich_postgres | 2025-01-19 15:52:08.377 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
immich_postgres | 2025-01-19 15:52:08.384 UTC [27] LOG: database system was shut down at 2025-01-19 15:33:52 UTC
immich_postgres | [2025-01-19T15:52:08Z INFO service::utils::clean] Find directory "pg_vectors/indexes/17331".
immich_postgres | [2025-01-19T15:52:08Z INFO service::utils::clean] Find directory "pg_vectors/indexes/17575".
immich_postgres | 2025-01-19 15:52:08.404 UTC [1] LOG: database system is ready to accept connections
immich_postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization
immich_postgres |
immich_postgres | 2025-01-19 15:52:08.367 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
immich_postgres | 2025-01-19 15:52:08.369 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
immich_postgres | 2025-01-19 15:52:08.370 UTC [1] LOG: could not create IPv6 socket for address "::": Address family not supported by protocol
immich_postgres | 2025-01-19 15:52:08.377 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
immich_postgres | 2025-01-19 15:52:08.384 UTC [27] LOG: database system was shut down at 2025-01-19 15:33:52 UTC
immich_postgres | [2025-01-19T15:52:08Z INFO service::utils::clean] Find directory "pg_vectors/indexes/17331".
immich_postgres | [2025-01-19T15:52:08Z INFO service::utils::clean] Find directory "pg_vectors/indexes/17575".
immich_postgres | 2025-01-19 15:52:08.404 UTC [1] LOG: database system is ready to accept connections
I have also setup that docker starts after 60 seconds after system boot, so definetly no race condition. So the problem is that i dont know where this shutdown request comes from. and i was hoping someone has an idea.
31 Replies
Immich
Immich4mo ago
:wave: Hey @EliasGabr, 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
Immich
Immich4mo ago
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. :blue_square: read applicable release notes. 3. :blue_square: reviewed the FAQs for known issues. 4. :blue_square: 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. :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.
GitHub
immich-app immich · Discussions
Explore the GitHub Discussions forum for immich-app immich. Discuss code, ask questions & collaborate with the developer community.
GitHub
Issues · immich-app/immich
High performance self-hosted photo and video management solution. - Issues · immich-app/immich
Daniel
Daniel4mo ago
Looks like a broken database Is the database folder existent at the time it starts up? Or is it possible it's just being mounted in that moment and some files could still be in some in-between state?
EliasGabr
EliasGabrOP4mo ago
the postgres folder is protected may that be a problem?
total 12
drwxr-xr-x 8 elias elias 4096 Dec 24 15:30 library
drwxr-xr-x 2 elias elias 4096 Dec 24 15:29 model-cache
drwx------ 20 999 elias 4096 Jan 19 16:52 postgres
total 12
drwxr-xr-x 8 elias elias 4096 Dec 24 15:30 library
drwxr-xr-x 2 elias elias 4096 Dec 24 15:29 model-cache
drwx------ 20 999 elias 4096 Jan 19 16:52 postgres
i will check that now
Daniel
Daniel4mo ago
What do you mean by protected? It has a different owner, which is fine TOherwise this looks like a corrupted DB for me. That however wouldn't make sense given a restart fixes it
EliasGabr
EliasGabrOP4mo ago
i knoe
Zeus
Zeus4mo ago
I’m confused. Your logs look fine What’s the actual issue and why do you see corruption Daniel?
EliasGabr
EliasGabrOP4mo ago
i have two logs one writtenm one linked i mean attached
Zeus
Zeus4mo ago
It’s likely your 60 second startup delay is broken and that’s what’s triggering a container reboot It sits happy for about 20 seconds then does a fast shutdown
Daniel
Daniel4mo ago
I read "find directory ... " as "could not find directory ..." :monakS:
EliasGabr
EliasGabrOP4mo ago
also without that it was broke what happens if i delete the database?
Zeus
Zeus4mo ago
This looks like some kind of docker issue Likely you’re using mount points that aren’t alive yet when docker starts You lose all your settings and have to reupload all images There’s also nothing wrong with it (that I can see so far)
EliasGabr
EliasGabrOP4mo ago
all of my docker data is in the home directory and the home directory is another partition that gets mounted after root that might be a problem too
Zeus
Zeus4mo ago
Yep, that’s what’s going on
EliasGabr
EliasGabrOP4mo ago
can you suggest anything to fix it?
Zeus
Zeus4mo ago
Make your system wait for the mount before boot Or make docker actually wait
EliasGabr
EliasGabrOP4mo ago
i already did that
EliasGabr
EliasGabrOP4mo ago
No description
Zeus
Zeus4mo ago
Yeah but it’s probably not working
EliasGabr
EliasGabrOP4mo ago
ok
EliasGabr
EliasGabrOP4mo ago
i did that as you can see here okay guys do you know how i can fix this i litterally dont care hoe janky the solution is
Zeus
Zeus4mo ago
How are you mounting it?
EliasGabr
EliasGabrOP4mo ago
i am mounting the /home partition using fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p3
UUID=c927b6c2-eeb3-4606-b8bf-2c78e5cf5aa5 / btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/ 0 0

# /dev/nvme0n1p1
UUID=B7F4-E27E /efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2

# /dev/sdb1
UUID=ee3813a0-b5f5-44f9-ac0f-1355fb1c55d5 /mnt/big ext4 rw,relatime 0 2

# /dev/nvme0n1p4
UUID=0897044f-b05f-4120-8090-4ad8327ae84a /home ext4 rw,defaults 0 2

# /dev/nvme0n1p2
UUID=94410117-1a4a-43a8-bb6b-1896cd093f3a none swap defaults 0 0
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p3
UUID=c927b6c2-eeb3-4606-b8bf-2c78e5cf5aa5 / btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/ 0 0

# /dev/nvme0n1p1
UUID=B7F4-E27E /efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2

# /dev/sdb1
UUID=ee3813a0-b5f5-44f9-ac0f-1355fb1c55d5 /mnt/big ext4 rw,relatime 0 2

# /dev/nvme0n1p4
UUID=0897044f-b05f-4120-8090-4ad8327ae84a /home ext4 rw,defaults 0 2

# /dev/nvme0n1p2
UUID=94410117-1a4a-43a8-bb6b-1896cd093f3a none swap defaults 0 0
Zeus
Zeus4mo ago
Your system is booting without /home being mounted??? That’s extremely cursed
EliasGabr
EliasGabrOP4mo ago
lmao but it mounts sometime after kernel it also says that in the arch wiki even recommended Hello, i fixed it by doing a restart unless stopped for the database is that okay? @Zeus @Daniel will that cause any problem? because in the dockercompose template there wasnt any restart unless stopped
Zeus
Zeus4mo ago
No need to tag anyone
EliasGabr
EliasGabrOP4mo ago
sorry
Zeus
Zeus4mo ago
I’m confused what did you have there before? Our compose is restart always How does this help?
EliasGabr
EliasGabrOP4mo ago
no i mean for database it wasnt i thinn how do i mark this issue as closed?
Immich
Immich4mo ago
This thread has been closed. To re-open, use the button below.

Did you find this page helpful?