Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Register Any Users With New Installation #3815

Open
MultiversalFish opened this issue Nov 24, 2024 · 4 comments
Open

Cannot Register Any Users With New Installation #3815

MultiversalFish opened this issue Nov 24, 2024 · 4 comments
Labels
question This issue is a question related to installation

Comments

@MultiversalFish
Copy link

Playbook Configuration:

My vars.yml file looks like this:

---
matrix_domain: redacted
matrix_homeserver_implementation: synapse
matrix_homeserver_generic_secret_key: redacted

matrix_playbook_reverse_proxy_type: playbook-managed-traefik
traefik_config_certificatesResolvers_acme_email: redacted

postgres_connection_password: redacted

matrix_coturn_turn_external_ip_address: redacted
matrix_homeserver_federation_enabled: false

matrix_authentication_service_enabled: true
matrix_authentication_service_config_secrets_encryption: redacted

matrix_static_files_container_labels_base_domain_enabled: true

Matrix Server:

  • OS: Ubuntu 21.04.01 LTS
  • Architecture x86_64

Ansible:
If your problem appears to be with Ansible, tell us:

  • where you run Ansible -- Nobara 40 Gnome
  • what version of Ansible you're running -- core 2.16.12

Problem description:

I am unable to register any users on my Matrix server, trying to do so gives a "No such file or directory" error. I haven't even been able to create my admin user. Trying to use Matrix Authentication Service as I would like to use the new features being developed for Element X.

The vars file used to be more complicated, I ended up uninstalling the server and starting from as bare bones a config I could, still the same issue. SSHing into the server and checking the locations, the cargo folder (part of the directory it's referencing) doesn't exist. I'm guessing that the playbook was supposed to set that up, but I don't even know where to begin troubleshooting why that isn't happening.

The log for trying to register a user with the playbook is below.

Thank you in advance if anyone has a guess as to why this is happening!

redacted@computername:~/matrix-docker-ansible-deploy$ ansible-playbook -i inventory/hosts setup.yml -K --extra-vars='username=RedactedUsername password=RedactedPassword admin=yes' --tags=register-user
BECOME password: 

PLAY [Set up a Matrix server] **************************************************************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************************************************************
[My hardware security key files are referenced here]
ok: [matrix.redacted.com]

TASK [custom/matrix-base : ansible.builtin.include_tasks] **********************************************************************************************************************************************************
included: /home/redacted/matrix-docker-ansible-deploy/roles/custom/matrix-base/tasks/setup_matrix_user.yml for matrix.redacted.com

TASK [custom/matrix-base : Ensure Matrix group is created] *********************************************************************************************************************************************************
ok: [matrix.redacted.com]

TASK [custom/matrix-base : Ensure Matrix user is created] **********************************************************************************************************************************************************
ok: [matrix.redacted.com]

TASK [custom/matrix-base : Initialize matrix_user_uid and matrix_user_gid] *****************************************************************************************************************************************
ok: [matrix.redacted.com]

TASK [custom/matrix-authentication-service : ansible.builtin.include_tasks] ****************************************************************************************************************************************
included: /home/redacted/matrix-docker-ansible-deploy/roles/custom/matrix-authentication-service/tasks/register_user.yml for matrix.redacted.com

TASK [custom/matrix-authentication-service : Fail if playbook called incorrectly] **********************************************************************************************************************************
skipping: [matrix.redacted.com]

TASK [custom/matrix-authentication-service : Fail if playbook called incorrectly] **********************************************************************************************************************************
skipping: [matrix.redacted.com]

TASK [custom/matrix-authentication-service : Fail if playbook called incorrectly] **********************************************************************************************************************************
skipping: [matrix.redacted.com]

TASK [custom/matrix-authentication-service : Ensure Matrix Authentication Service is started] **********************************************************************************************************************
ok: [matrix.redacted.com]

TASK [custom/matrix-authentication-service : Wait a while, so that Matrix Authentication Service can start] ********************************************************************************************************
skipping: [matrix.redacted.com]

TASK [custom/matrix-authentication-service : Register user] ********************************************************************************************************************************************************
fatal: [matrix.redacted.com]: FAILED! => changed=false 
  cmd:
  - /matrix/matrix-authentication-service/bin/register-user
  - RedactedUsername
  - RedactedPassword
  - '1'
  delta: '0:00:00.087669'
  end: '2024-11-24 01:40:51.591809'
  msg: non-zero return code
  rc: 1
  start: '2024-11-24 01:40:51.504140'
  stderr: |-
    2024-11-24T01:40:51.559751Z  WARN db.connect: sqlx_postgres::options::pgpass: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-postgres-0.8.1/src/options/pgpass.rs:46: Failed to open `.pgpass` file: Os { code: 2, kind: NotFound, message: "No such file or directory" } path=/.pgpass
    Error: Username not available on homeserver
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

PLAY RECAP *********************************************************************************************************************************************************************************************************
matrix.redacted.com   : ok=7    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   

Additional context
I have previously hosted a server using this playbook, using a Raspberry Pi 4. That one was always experimental and never federated. I am not migrating any data to the new server computer.

@MultiversalFish MultiversalFish added the question This issue is a question related to installation label Nov 24, 2024
@spantaleev
Copy link
Owner

spantaleev commented Nov 24, 2024

This part is just a warning:

WARN db.connect: sqlx_postgres::options::pgpass: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-postgres-0.8.1/src/options/pgpass.rs:46: Failed to open .pgpass file: Os { code: 2, kind: NotFound, message: "No such file or directory" } path=/.pgpass

It can be ignored.

The actual error seems to be:

Error: Username not available on homeserver


Digging through the element-hq/matrix-authentication-service source code, this error is produced here

This check is done against Synapse, so the following reasons may be why it happens:

  • Synapse is not up yet and Matrix Authentication Service does not properly distinguish between "error while failing to communicate with Synapse" and "Synapse returned an error - username is not allowed". Looking at the code for is_localpart_available() and the way it's invoked, I think the distinction is being made and Matrix Authentication Service will report Synapse being down in another way
  • communication with Synapse is OK and it really did respond with "username is not allowed"

Perhaps try registering a different username? Maybe the one you're testing with is not OK for some reason. It could be that Synapse does not consider it OK, Matrix Authentication Service passes it in the wrong way or the Ansible playbook somehow mangles the username while passing it around.

I've just tried registering a user against Matrix Authentication Service via ansible-playbook and --tags=register-user and was successful, so this does not appear to be a common bug affecting everyone.

@MultiversalFish
Copy link
Author

Hey, I appreciate you explaining the error to me, that let me figure out a different solution to the problem.

I ended up importing everything from my old server to the new, as I suspected there was a conflict with my username even though the old server was never federated. Logged back in and good to go.

Thank you good sir!

@spantaleev
Copy link
Owner

Why reopen? Are you experiencing the same or similar issue again?

@MultiversalFish
Copy link
Author

Yes, sorry I got pulled away before I could post a comment with an explanation.

But yes, the problem is back. Migrated the server, got all the old accounts running, figured that was the end of it.

Can't register any new users at all, tried several different names to be sure. Used the playbook previously, I've also SSH'd into the server and ran the registration commands directly. Same error, each time. The usernames I tried were for sure not registered on my server.

You mentioned previously it might be Matrix Authentication Service not communicating with Synapse properly, would you have an idea what logs I should pull to figure out what the potential disconnect might be? Your help is much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This issue is a question related to installation
Projects
None yet
Development

No branches or pull requests

2 participants