I’m trying to get Lemmy up and running on an Ubuntu 22.04 host. I’ve followed this guide supplemented by googling.

I can actually get to the front end, but it gives me “There was an error on the server.” When I dig into the logs, I see this:

"thread 'main' panicked at 'Error connecting to postgres://lemmy:<my pg password>@postgres:5432/lemmy: FATAL:  password authentication failed for user \"lemmy\"\n","stream":"stderr","time":"2023-06-26T03:14:17.47460915Z"}

The only thing I can find about this error related to Lemmy is this thread, which indicates that the password was not defined in the docker-compose.yml file prior to starting the containers. I have since redone the configuration three times, each time deleting the volumes folder and double-checking that my postgre password is correct both in docker-compose.yml and lemmy.hjson.

Any ideas what might be the problem? Thank you kindly for any help you can provide!

  • tkohhh@waveform.socialOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I learned something interesting in doing some more testing…

    Using the -W option does indeed prompt for a password, but it accepts any value entered at the password prompt. In order to actually authenticate with a password when using psql, you must modify the pg_hba.conf file to use scram-sha-256 as the method for type local.

    When I do this, I am unable to authenticate (both while using my actual password, and also while using a password of “test”.

    And then I figured out the problem.

    In my docker-compose.yml, I had put single quotes around my postgres password, thinking this would be safe per my understanding of this question. However, just to check, I tried logging in to psql using the password 'test'. Sure enough, it worked.

    I found another stack exchange with some different advice on strings in yaml: https://stackoverflow.com/questions/53082932/yaml-docker-compose-spaces-quotes

    So, I tried my password again, without the single quotes… and it worked.

    Perhaps this will help somebody beating their head against the wall in the future.