#Problem with Immich Setup on QNAP (Database Error)

1 messages · Page 1 of 1 (latest)

radiant ember
#

Hi everyone,
I have been trying to install Immich on my QNAP NAS (model TVS-473, 64 GB RAM, AMD RX-421BD CPU) using Docker (Container Station and Portainer).

I tried setting up the Immich containers manually via Portainer, but I keep running into issues where the microservices fail to connect to the database (PostgreSQL with pgvector). The error I get is:
TypeError: Cannot read properties of undefined (reading 'replace')

I have now completely cleaned up everything:
• Deleted all containers, volumes, and images
• Deleted all Immich-related folders
• Reset folder permissions
• Portainer was fully removed

Now I would like to properly reinstall Immich from scratch.

Could someone here please guide me or provide a correct and working docker-compose.yml file that fits my setup? Ideally it should work well with QNAP and Portainer.

Thank you so much in advance for your help!

subtle oakBOT
#

:wave: Hey @radiant ember,

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

#

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. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
  6. :blue_square: 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.

radiant ember
#

Hi everyone,

I am trying to set up Immich from scratch on my QNAP NAS (model TVS-473, 64 GB RAM, AMD RX-421BD CPU) using Docker/Portainer.

I had previously attempted a manual installation via Portainer, but I kept encountering database connection errors (TypeError: Cannot read properties of undefined (reading 'replace')).

Now, I have fully cleaned my system:
• Completely removed Portainer (including the portainer_data volume)
• Deleted all Immich containers, images, networks, and volumes
• Cleared the Immich folder on my NAS
• Reset the file permissions to admin-only (chmod 700)

Current situation:
I would like to reinstall Immich correctly with a clean docker-compose.yml setup that fits my environment and QNAP configuration.

I have reviewed the checklist:
• ✅ Latest release verified
• ✅ Release notes checked
• ✅ FAQ and GitHub issues reviewed
• ✅ Attempted local access without reverse proxy
• ✅ Troubleshooting with incognito mode, extensions disabled, cache cleared
• ✅ Full logs available if needed

System details:
• QNAP NAS TVS-473, AMD RX-421BD, 64 GB RAM
• QTS version 5.2.3.3006
• Storage: Standard encrypted volume
• Docker CE, trying with Portainer CE

I would really appreciate if someone could guide me through the proper setup, or provide a clean, working docker-compose.yml example that is known to work well with QNAP.

Thank you so much in advance for any support!

rugged swallow
#

The error indicates it can't talk to the database container

#

Why would you set file permissions to 700?

radiant ember
#

Good point, thanks!

I had reset the permissions to 700 to lock down access temporarily after cleaning up the system.

However, I now realize that this prevents the Docker containers (Postgres and Immich) from accessing their volumes properly.

I will correct it to:

sudo chmod -R 770 /path/to/Immich
sudo chown -R admin:everyone /path/to/Immich

so that the containers can read/write inside the mounted volumes.

Thanks for pointing that out!

rugged swallow
#

Just FYI @radiant ember the files within the database location will have permissions set to uid:gid 999:999 usually

radiant ember
#

I have created the folders photos and pgdata now using sudo, and I set the permissions according to the recommendation (770 with correct owner/group). Ready to continue.

radiant ember
#

Quick update based on the progress:

After adjusting the permissions (770 + correct owner/group) as discussed, I started a fresh new setup:

  • Completely cleaned up old containers, volumes, and networks
  • Created a new docker-compose.yml from scratch
  • Created the folders /photos and /pgdata freshly with sudo and applied the correct permissions
  • Volumes are now correctly mounted into the containers

Current situation:

  • All three containers (immich-db, immich-redis, immich-server) are starting
  • But the immich-server container shows the following error in the logs:
    Error: connect ECONNREFUSED 172.29.0.2:5432
    
  • It seems that the Immich server is trying to connect to the database before it's fully ready.

My next thoughts/questions:

  • Do I need to add a healthcheck or wait-for-it script for the database startup?
  • Or maybe add depends_on with the correct options for waiting?
  • Is there something specific about QNAP and volume/database startup timing I should be aware of?

Thanks a lot for your amazing help so far! 🙏
I'm ready to continue here as needed 🚀

rugged swallow
#

The default compose has the immich-server depend on the database/redis. Does it eventually start or not?

#

Did you make your own compose or something?

torn cradle
#

Also the database should not take long to start. If that message appears once or twice before it starts up that’s fine

torn cradle
rugged swallow
#

Right, but that shouldn't mean anything if you just compose up, right? 👀

#

riight?

torn cradle
#

Yes yes just as an aside

#

Wait actually thought we don’t specify condition: service_healthy

#

So it doesn’t mean a whole lot. It will literally start PG then instantly start immich

#

That.. might be good to add.

#

The problem is it sometimes takes like a minute to come up as healthy lol

#

So there’s not a good solution