Skip to content

Problem with ipv6?! (Name or service not known) #202

@egabosh

Description

@egabosh

Moin,

Unfortunately, I get the following message on servers that are only accessible via IPv6, so I assume that Matrix Commander has a problem with IPv6.
Can you confirm this and fix it?

# docker run -t -v ./matrix-commander-data:/data:rw  matrixcommander/matrix-commander  --joined-rooms --output text --debug
2025-09-15 11:44:42,324:    DEBUG: matrix-commander: Debug is turned on. debug count=1
2025-09-15 11:44:42,324:    DEBUG: matrix-commander: Separator is set to "    " of length 4. E.g. Col1    Col2.
2025-09-15 11:44:42,324:    DEBUG: matrix-commander: Encryption is always enabled. It cannot be turned off. Use --tail to disable it for specific use cases.
2025-09-15 11:44:42,324:    DEBUG: matrix-commander: Option --sync is set to full.
2025-09-15 11:44:42,324:    DEBUG: matrix-commander: All arguments are valid. All checks passed.
2025-09-15 11:44:42,434:    DEBUG: matrix-commander: Create directory /root/.run for PID file.
2025-09-15 11:44:42,434:    DEBUG: matrix-commander: Trying to create a PID file to store process id 1.
2025-09-15 11:44:42,434:    DEBUG: matrix-commander: Successfully created PID file "/root/.run/matrix-commander.1515ab64-a820-4c8e-9d3d-3bd39efc69ae.pid" to store process id 1.
2025-09-15 11:44:42,434:    DEBUG: matrix-commander: Python version is "3.11.6 (main, Oct  3 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)]"
2025-09-15 11:44:42,434:    DEBUG: matrix-commander: Stdin pipe is assigned to "none".
2025-09-15 11:44:42,434:    DEBUG: matrix-commander: SSL will be used. Default SSL certificate validation will be done for this connection.
2025-09-15 11:44:42,435:    DEBUG: matrix-commander: Credentials file existed. So this is the one we suggest to use. file: /data/credentials.json
2025-09-15 11:44:42,436:    DEBUG: matrix-commander: Found an existing store in directory "/data/store" (local or arguments). It will be used.
2025-09-15 11:44:42,436:    DEBUG: matrix-commander: Starting to read credentials file.
2025-09-15 11:44:42,437:    DEBUG: matrix-commander: Finished reading credentials file.
2025-09-15 11:44:42,437:    DEBUG: matrix-commander: About to configure Matrix Async Client.
2025-09-15 11:44:42,437:    DEBUG: matrix-commander: About to initialize Matrix Async Client.
2025-09-15 11:44:42,437:    DEBUG: matrix-commander: About to restore login.
2025-09-15 11:44:42,461:    DEBUG: matrix-commander: Finished restoring login.
2025-09-15 11:44:42,461:    DEBUG: matrix-commander: Login will be using stored credentials from credentials file "/data/credentials.json". room_id = #MYHOST.MYDOMAIN:matrix.MYHOST.MYDOMAIN, device_id = BPMROLRAGZ, access_token = s***k.
2025-09-15 11:44:42,461:    DEBUG: matrix-commander: About to connect to server to verify connection.
2025-09-15 11:44:42,534:    ERROR: matrix-commander: E248: The program matrix-commander.py failed. Sorry.
2025-09-15 11:44:42,534:    DEBUG: matrix-commander: Cleanup: cleaning up.
2025-09-15 11:44:42,542:    ERROR: matrix-commander: Cannot connect to host matrix.MYHOST.MYDOMAIN:443 ssl:default [Name or service not known]
Here is the traceback.
Traceback (most recent call last):
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/connector.py", line 1512, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/connector.py", line 1128, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/connector.py", line 1159, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/resolver.py", line 40, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/base_events.py", line 867, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/matrix_commander/matrix_commander.py", line 10285, in main
    main_inner(argv)
  File "/app/matrix_commander/matrix_commander.py", line 10234, in main_inner
    asyncio.run(async_main())  # do everything in the event loop
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/app/matrix_commander/matrix_commander.py", line 7229, in async_main
    await implicit_login()
  File "/app/matrix_commander/matrix_commander.py", line 7195, in implicit_login
    client, credentials = await login_using_credentials_file()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/matrix_commander/matrix_commander.py", line 3997, in login_using_credentials_file
    raise (e)
  File "/app/matrix_commander/matrix_commander.py", line 3992, in login_using_credentials_file
    resp = await client.whoami()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 3617, in whoami
    return await self._send(WhoamiResponse, method, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 834, in _send
    transport_resp = await self.send(
                     ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 307, in wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 912, in send
    return await self.client_session.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/client.py", line 770, in _request
    resp = await handler(req)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/client.py", line 725, in _connect_and_send_request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 281, in connect_wrapper
    connection = await type(self).connect(self, *args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/connector.py", line 622, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/connector.py", line 1189, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.11/site-packages/aiohttp/connector.py", line 1518, in _create_direct_connection
    raise ClientConnectorDNSError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorDNSError: Cannot connect to host matrix.MYHOST.MYDOMAIN:443 ssl:default [Name or service not known]

2025-09-15 11:44:42,544:     INFO: matrix-commander: 2 errors and 0 warnings occurred.

Workaround on the same machine is to use /etc/hosts with local IPv4 IP and run container with -v /etc/hosts:/etc/hosts:ro
Then it works but only in local setups with IPv4.

Thank you
olli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions