alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.56k stars 223 forks source link

❓ [immich] Does not connect to postgress 'FATAL: password authentication failed for user "postgres"' #1614

Open JzBrevis opened 1 month ago

JzBrevis commented 1 month ago

The postgres addon is working. I can connect to it with the set password from a client.

immich can't connect to it, the password I set in the config is the same one that works in the client but it seems to not be used.

Already tried setting the password in config/addon_config/immich/config.yaml, but it makes no difference.

Log when starting immich: (<redacted> is the actual password and jwt token I set)

-----------------------------------------------------------
 Add-on: Immich
 Self-hosted photo and video backup solution directly from your mobile phone
-----------------------------------------------------------
 Add-on version: 1.118.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 13.1  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.10.3
 Home Assistant Supervisor: 2024.10.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
DB_DATABASE_NAME='immich'
DB_HOSTNAME='db21ed7f-postgres'
DB_PASSWORD=******
DB_PORT='5432'
DB_USERNAME='postgres'
DISABLE_MACHINE_LEARNING='false'
JWT_SECRET='<redacted>'
PGID='1000'
PUID='1000'
TZ='Europe/Paris'
data_location='/share/immich'
/etc/cont-init.d/00-local_mounts.sh: executing
/etc/cont-init.d/00-smb_mounts.sh: executing
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/addons_config/immich/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /homeassistant/addons_config/immich/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

DB_PASSWORD='<redacted>'
/etc/cont-init.d/01-custom_script.sh: executing
Execute /homeassistant/addons_autoscripts/immich.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/20-folders.sh: executing
[00:19:38] INFO: Setting data location
... check /share/immich folder exists
... setting permissions
... correcting official script
/etc/cont-init.d/99-run.sh: executing
[00:19:38] INFO: Setting variables
DB_DATABASE_NAME='immich'
DB_HOSTNAME='db21ed7f-postgres'
DB_PASSWORD=******
DB_PORT='5432'
DB_USERNAME='postgres'
DISABLE_MACHINE_LEARNING='false'
JWT_SECRET='<redacted>'
PGID='1000'
PUID='1000'
TZ='Europe/Paris'
data_location='/share/immich'
[00:19:38] INFO: Defining database
[00:19:38] INFO: -----------------
[00:19:38] INFO: Connecting to external postgresql
[00:19:38] INFO: 
psql: error: connection to server at "db21ed7f-postgres" (172.30.33.5), port 5432 failed: FATAL:  password authentication failed for user "postgres"

Starting the upstream container

[mod-init] Running Docker Modification Logic
[mod-init] Adding imagegenius/mods:universal-redis to container
[mod-init] Downloading imagegenius/mods:universal-redis from registry-1.docker.io
[mod-init] Installing imagegenius/mods:universal-redis
[mod-init] imagegenius/mods:universal-redis applied to container
[migrations] started
[migrations] no migrations found

╔═══════════════════════════════╗
       __  _____ _____       __
      / / |_   _/ ____|     / /
     / /    | || |  __     / /
    / /     | || | |_ |   / /
   / /     _| || |__| |  / /
  /_/     |_____\_____| /_/

  Baseimage from linuxserver.io
╠═══════════════════════════════╣
  User/Group ID:
  User UID: 1000
  User GID: 1000
╚═══════════════════════════════╝
yvos commented 3 weeks ago

Hi,

I have the same issue trying to get TeslaMate running. I have set the POSTGRES_PASSWORD in the configuration. Also tried setting the username but it didn't matter.

2024-10-26 13:25:30.119 CEST [299] FATAL: password authentication failed for user "postgres" 2024-10-26 13:25:30.119 CEST [299] DETAIL: Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"

alexbelgium commented 3 weeks ago

Hi, I think that postgres's password can't be changed after running it once. You could try with the default password, homeassistant

JzBrevis commented 3 weeks ago

Hi, I think that postgres's password can't be changed after running it once. You could try with the default password, homeassistant

At least for me, postgres is using the correct password. I confirmed this by connecting with my own client, which only works with the expected password

JzBrevis commented 3 weeks ago

I got it to work now by resetting the postgres addon and setting it up with the default password. If I do that, the immich addon is able to connect to postgres.

JzBrevis commented 3 weeks ago

I repeated the same process, now using a different password without special characters, this is working. The previous, unusable password contained the '!' and '%' characters.

yvos commented 3 weeks ago

Yes! Resetting the add-on and using the default pw worked for me too.

alexbelgium commented 3 weeks ago

Thanks very much ! Perhaps it's an issue with characters escape. I'll look if I can do something. I think it's also due to how HA manages strings (with " and not ')