Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Docker error: local user with ID 991 does not exist #16285

Closed
alirezaalavi87 opened this issue Sep 9, 2023 · 4 comments
Closed

Docker error: local user with ID 991 does not exist #16285

alirezaalavi87 opened this issue Sep 9, 2023 · 4 comments
Labels
X-Needs-Info This issue is blocked awaiting information from the reporter

Comments

@alirezaalavi87
Copy link

Hi.
I couldn't resolve my issue by asking in the matrix server.
I use docker compose to run the app:

# This compose file is compatible with Compose itself, it might need some
# adjustments to run properly with stack.

version: '3'

services:

  synapse:
    build:
        context: ../..
        dockerfile: docker/Dockerfile
    image: docker.io/matrixdotorg/synapse:latest
    # Since synapse does not retry to connect to the database, restart upon
    # failure
    restart: unless-stopped
    # See the readme for a full documentation of the environment settings
    # NOTE: You must edit homeserver.yaml to use postgres, it defaults to sqlite
    environment:
      - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
    volumes:
      # You may either store all the files in a local folder
      - ./files:/data
    depends_on:
      - db
    # In order to expose Synapse, remove one of the following, you might for
    # instance expose the TLS port directly:
    ports:
      - 8008:8008/tcp

  db:
    image: docker.io/postgres:12-alpine
    # Change that password, of course!
    environment:
      - POSTGRES_USER=synapse
      - POSTGRES_PASSWORD=123
      # ensure the database gets created correctly
      # https://matrix-org.github.io/synapse/latest/postgres.html#set-up-database
      - POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
    volumes:
      # You may store the database tables in a local folder..
      - ./schemas:/var/lib/postgresql/data
      # .. or store them on some high performance storage for better results
      # - /path/to/ssd/storage:/var/lib/postgresql/data

And I get this error:

synapse-synapse-1  |  Error during initialisation:
synapse-synapse-1  |      Traceback (most recent call last):
synapse-synapse-1  |        File "/usr/local/lib/python3.11/site-packages/synapse/app/homeserver.py", line 353, in setup
synapse-synapse-1  |          hs.setup()
synapse-synapse-1  |        File "/usr/local/lib/python3.11/site-packages/synapse/server.py", line 340, in setup
synapse-synapse-1  |          self.datastores = Databases(self.DATASTORE_CLASS, self)
synapse-synapse-1  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
synapse-synapse-1  |        File "/usr/local/lib/python3.11/site-packages/synapse/storage/databases/__init__.py", line 65, in __init__
synapse-synapse-1  |          with make_conn(database_config, engine, "startup") as db_conn:
synapse-synapse-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
synapse-synapse-1  |        File "/usr/local/lib/python3.11/site-packages/synapse/storage/database.py", line 161, in make_conn
synapse-synapse-1  |          native_db_conn = engine.module.connect(**db_params)
synapse-synapse-1  |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
synapse-synapse-1  |        File "/usr/local/lib/python3.11/site-packages/psycopg2/__init__.py", line 122, in connect
synapse-synapse-1  |          conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
synapse-synapse-1  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
synapse-synapse-1  |      psycopg2.OperationalError: local user with ID 991 does not exist

I have found this related issue: #13190
but still don't understand what causes it and how to fix it.

@clokep
Copy link
Member

clokep commented Sep 11, 2023

Did you make any changes to your Dockerfile?

Does removing the following fix the issue?

    build:
        context: ../..
        dockerfile: docker/Dockerfile

Please use synapse admins for support requests.

@clokep clokep added the X-Needs-Info This issue is blocked awaiting information from the reporter label Sep 11, 2023
@alirezaalavi87
Copy link
Author

No it doesn't.
also I figured (with the help of friends in matrix group) that my docker is in rootless mode. but still pruning everything and running with sudo doesn't fix the issue.

I asked in the matrix chat and they tried to help, but issue didn't get fixed. and wouldn't having issues and their solutions in here be better since they're easily searchable?

@reivilibre
Copy link
Contributor

have you specified a Postgres host and username in your database configuration? I can see this happening if psycopg2 is about to try to connect to the (hypothetical in this case) local Postgres server using a UNIX socket and is attempting to determine the local user's name.

@alirezaalavi87
Copy link
Author

@reivilibre yes, the configs are correct.
I am no longer trying to run synapse, but I think adding this to the docker-compose.yml fixed the issue:

    environment:
      - UID=0

I will close this issue since I'm not trying to run a synapse server at the moment and am not 100% sure how I fixed the issue (or did I fix it at all) but anyone with the same issue can open it again

@alirezaalavi87 alirezaalavi87 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
X-Needs-Info This issue is blocked awaiting information from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants