Unable to connect to the database. Retrying (1)... microservices worker exited with code 1
I have Immich deployed on my synology(1522+). The strange thing is that it has worked for me sometimes and sometimes when I restarted I got this error. The thing is that now it always appears.😩
61 Replies
:wave: Hey @alvaro8659,
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_01GY0DAKGXDEHE263BCAYEGFJAChecklist
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.GitHub
immich-app immich · Discussions
Explore the GitHub Discussions forum for immich-app immich. Discuss code, ask questions & collaborate with the developer community.
FAQ | Immich
User
GitHub
Issues · immich-app/immich
High performance self-hosted photo and video management solution. - Issues · immich-app/immich
this is the configuration
Successfully submitted, a tag has been added to inform contributors. :white_check_mark:
What do the database logs say? They're at
DB_DATA_LOCATION/logs
and is the container actually down or not? docker ps -a
Hello Mraedis,

where is "DB_DATA_LOCATION/logs
" located??
All your containers have only been up for 5 minutes, do you shut down your server?
Wherever you defined it to be ie your env var
Yes, I just restarted it, it turns out that 10% of the time it works. I restarted it because it wasn't giving any problems
its okey this?
now i think i have new error
The funny thing is that sometimes it works and sometimes it doesn't.
These are the container logs, the postgres logs are on disk in that folder I mentioned
okey, ill serarch
i put this location UPLOAD_LOCATION=./library
The location where your database files are stored
DB_DATA_LOCATION=./postgres
. means "this folder" so it's in where your compose file is, in a folder called postgres, and in that folder there is another called logs
Looks like it can't reach the redis container though

It's a synology, maybe it's somewhere else?
I can see the "postgres" folder right there
Also please don't private message me @alvaro8659 😛
okey sorry
That's looking pretty good really
Is it still restarting?
yes
docker ps -a
are all containers restarting or just server + redis?only server


In the portainer GUI, do you see IPs assigned like this?


All good... try selecting immich_server + redis and pressing restart
okey
same problem
the redis reachable errors, right?
Could you go in the redis container menu and recreate it?

same error i recreate
and restart server and redis
alright one more thing to try then
stop the stack
Then go to images and delete all unused ones
the data is safe on your disk, no worries
Then start the stack again, this should re-pull the containers
This might take a while and I'm going for a run meantime :Eyey
👀
i got the same error

ok wait i just restarted the containers. i'll try relaunching everything. will any of my configuration be deleted?
No the data is safe

You forgot to change .env to stack.env if you made a new compose
But I did tell you to stop the stack not delete it... Data is still safe but a bit more annoying to restart the stack


okey now working
well starting

Failed to deploy a stack: Network immich_default Creating
Network immich_default Created
Container immich_machine_learning Creating
Container immich_redis Creating
Container immich_postgres Creating
Container immich_machine_learning Created
Container immich_redis Created
Container immich_postgres Created
Container immich_server Creating
Container immich_server Created
Container immich_postgres Starting
Container immich_machine_learning Starting
Container immich_redis Starting
Container immich_redis Started
Container immich_machine_learning Started
Error response from daemon: Bind mount failed: '/data/compose/17/postgres' does not exist
Ok stop the stack, please don't delete it
show me
ls -la /data/compose/10
and ls -la /data/compose/17
i delete it, but now i cant re-deploy
Could you please just do the above, thanks

Do you keep deleting the stack or something? Stopping and deleting are not the same thing
To be clear @alvaro8659 your data is safe on your synology but we need to point the stack in the right direction so it immich will run with it
perfect, so what do i do now¿
Ok please don't delete anything I don't tell you to for starters
find /data/ -type d -name postgres
let's start with that
This folder still populated right?yes
its populate
Could you answer both questions please
Could you make a new stack in portainer and for the env file put this:
Er, this will be better for portainer GUI:
It seems to be working fine now! I'll wait to confirm that the problem doesn't happen again. Thank you very much for your help. Is there any way I can return the favor?
No worries, glad it went smoothly 🙂
The only favor you can do us is buy a license product key, other than that just keep your data safe!
If the error does not occur again, I will of course buy the license. Many thanks once again.😊💪