I went to upgrade Lemmy from 18.4 to 18.5 but in the process it failed with an incorrect Postgres password error. I'm trying to create a new docker container and mount the postgres volume in order to reset the "lemmy" user password but can't figure out how to get it running without knowing the password.
Could anyone point me in the right direction, please?
So you don't have the root database password, or just the Lemmy user password?
Might be worth it to make a new database and create a new Lemmy user and migrate data from the backup.
I found this article which might help: https://www.postgresqltutorial.com/postgresql-administration/postgresql-reset-password/
I've only ever used Maria dB so YMMV.
I got it back up! I was able to reset the database user's password.
Having helped someone else through a similar update issue, I'm going to assume you're using the Ansible deploy method.
If you're using the Ansible playbook method, and don't understand every single step the playbook is doing, I recommend deploying Lemmy manually.
It sounds like your Posgres password changed in the playbook variables and got set to a new value in the lemmy config and docker-compose files. But once a Postgres DB is initialized, the env vars for the initial DB, user, and password are no longer needed/processed. Thus, your compose file, playbook, and lemmy config have a different password than what Postgres was setup with.
Try shelling into your Postgres container and re-setting the password for the Lemmy user to what's defined in the lemmy config and compose file and seeing if that gets you past the incorrect password error.
I used the Lemmy-Easy-Deploy method but the catch is that I migrated from Google Cloud Free Tier to a paid server with another host. I have the backups so I can always restore from that if I really have to. I have an env file with the password that it should be using but I'm not sure how it was changed…
My advice: drop the "easy button" stuff and deploy it manually. You'll have WAY less headaches in the long run. Either way, it sounds like your Postgres password is out of sync with what the config files have. So try updating that through a root shell in the PG container to what's documented in your other config files.
I couldn't get my container started with postgress running but I had an idea:
I started the upgrade process with Lemmy-Easy-Deploy,
canceled out of it before it removed the containers,
ran
sudo docker exec -i lemmy-easy-deploy-postgres-1 psql -U lemmy -c "alter user lemmy with password 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'"
with the password set in my
env
file,then restarted the upgrade process. It's running again.
The odd part is that it was running fine until the upgrade.