Closed rizzek closed 1 year ago
Hi @rizzek :)
Strange, could you check if you have any output doing the following commands:
sudo yunohost app setting mautrix_telegram db_name
sudo yunohost app setting mautrix_telegram db_user
sudo yunohost app setting mautrix_telegram psqlpwd
(do not post this output)
If all this commands output values, then could you try the following command to see if the db is setup correctly:
sudo --login --user=postgres PGUSER="$(yunohost app setting mautrix_telegram db_user)" PGPASSWORD="$(yunohost app setting mautrix_telegram psqlpwd)" psql "$(yunohost app setting mautrix_telegram db_name)"
Last check could be to see the contents of /etc/yunohost/apps/mautrix_telegram/settings.yml
(do not post them here) and see if any of those keys are missing.
Hi there, @thardev.
All those commands don't yield any output. That means that the values for that didn't get stored properly after the first install, does it?
In the settings.yml there are values set for mautrix_bridge_db_name
and mautrix_bridge_db_pwd
(no mautrix_bridge_db_user
if that was expected to be in there).
Yes, it seems to be the case, so I guess the Postgres db is not setup correctly. When did you do the reinstall? Because recently, like 9 days ago, a big refactor was done in the install script and if you tried reinstalling before that refactor some unexpected error could had happened.
Could you try reinstalling one more time please? :)
Maybe before doing it also run sudo yunohost tools update
The reinstall failed. I won't share the whole log because the YunoPaste also contains my API secrets. But when setting up the database it says that the user mautrix_telegram already exists and I should provide its password.
2022-09-29 20:45:37,833: INFO - [##############......] > Creating a PostgreSQL database... 2022-09-29 20:45:37,833: DEBUG - ++ ynh_sanitize_dbid --db_name=mautrix_telegram 2022-09-29 20:45:37,846: DEBUG - ++ echo mautrix_telegram 2022-09-29 20:45:37,847: DEBUG - + db_name=mautrix_telegram 2022-09-29 20:45:37,847: DEBUG - + db_user=mautrix_telegram 2022-09-29 20:45:37,847: DEBUG - + ynh_app_setting_set --app=mautrix_telegram --key=db_name --value=mautrix_telegram 2022-09-29 20:45:37,847: DEBUG - + local _globalapp=mautrix_telegram 2022-09-29 20:45:37,925: DEBUG - + app=mautrix_telegram 2022-09-29 20:45:37,925: DEBUG - + [[ dbname =~ (unprotected|protected|skipped) ]] 2022-09-29 20:45:37,925: DEBUG - + ynh_app_setting set mautrix_telegram db_name mautrix_telegram 2022-09-29 20:45:38,005: DEBUG - + ynh_psql_test_if_first_run 2022-09-29 20:45:38,006: DEBUG - + dpkg --list 2022-09-29 20:45:38,006: DEBUG - + grep -q 'ii postgresql-13' 2022-09-29 20:45:38,038: DEBUG - + yunohost tools regen-conf postgresql 2022-09-29 20:45:41,103: DEBUG - + ynh_psql_setup_db --db_user=mautrix_telegram --db_name=mautrix_telegram 2022-09-29 20:45:41,104: DEBUG - + db_pwd= 2022-09-29 20:45:41,159: DEBUG - + ynh_psql_user_exists --user=mautrix_telegram 2022-09-29 20:45:41,172: DEBUG - + grep --quiet mautrix_telegram 2022-09-29 20:45:41,172: DEBUG - ++ cat /etc/yunohost/psql 2022-09-29 20:45:41,174: DEBUG - + sudo --login --user=postgres PGUSER=postgres PGPASSWORD=** psql -tAc 'SELECT rolname FROM pg_roles WHERE rolname='\''mautrix_telegram'\'';' 2022-09-29 20:45:41,342: DEBUG - + return 0 2022-09-29 20:45:41,343: DEBUG - + '[' -z ']' 2022-09-29 20:45:41,343: DEBUG - + ynh_die '--message=The user mautrix_telegram exists, please provide his password' 2022-09-29 20:45:41,366: DEBUG - + ynh_exit_properly 2022-09-29 20:45:41,367: WARNING - The user mautrix_telegram exists, please provide his password 2022-09-29 20:45:41,869: DEBUG - + ynh_clean_setup 2022-09-29 20:45:41,869: DEBUG - + true 2022-09-29 20:45:42,874: ERROR - Unable to install mautrix_telegram: An error occurred inside the app installation script
Ok, I see... could you try the following:
sudo --user=postgres PGUSER="postgres" PGPASSWORD="$(cat /etc/yunohost/psql)" psql
If you can connect (hopefully yes) type \l
and check if you have an existing mautrix_telegram
database.
If yes, run the following command to drop it:
sudo --user=postgres dropdb mautrix_telegram
Then try reinstalling again 👍
I can't. I'm connected as "admin" (shouldn't I?) and it says
Sorry, user admin is not allowed to execute '/usr/bin/psql' as postgres on rizzek.com.
Yes, you are right to be connected as admin but I guess that for this operation we need root privileges or it seems so... Do you have access to root user?
Well, I was able tosudo su
.
It worked, there is no mautrix_telegram database.
Should I go ahead and try sudo --user=postgres dropuser mautrix_telegram
?
yes, that could help as well :)
It also failed (because the role "mautrix_telegram" did not exist) but I was able to reinstall mautrix_telegram nevertheless. Maybe the rollback of the install script already tidied up after itself and deleted postgres stuff for mautrix_telegram?
Right now I am able to use the bridge again.
I also rebooted and it seems like my problem is fixed.
Many thanks for your time and your help, @thardev 👍
Great! 😄 I'm glad that you solved it! 👍
Describe the bug
Service "mautrix_telegram" fails to start
Context
Steps to reproduce
Not sure if reproducible, but:
Expected behavior
The mautrix_telegram service restarts successfully when rebooting or when clicking the "Restart" button in the Services webadmin page.
Logs
https://pastebin.com/Z1094U1E (YunoPaste was not working due to CORS settings)