Skip to content

password authentication failed, brand new installation #816

Closed

Description

@simowilso

Hi,

Potential new user of docmost here but I can't figure out this error. I can see others have had a similar issue before but the issue was closed:

Here's my docker-compose.yml
`services:
docmost:
image: docmost/docmost:latest
depends_on:
- db
- redis
environment:
APP_URL: 'http://192.168.0.54:3001'
APP_SECRET: '********************'
DATABASE_URL: 'postgresql://docmost:
@db:5432/docmost?schema=public'
REDIS_URL: 'redis://redis:6379'
ports:
- "3001:3000"
restart: unless-stopped
volumes:
- docmost:/app/data/storage

db:
image: postgres:16-alpine
environment:
POSTGRES_DB: docmost
POSTGRES_USER: docmost
POSTGRES_PASSWORD: ***************
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql/data

redis:
image: redis:7.2-alpine
restart: unless-stopped
volumes:
- redis_data:/data

volumes:
docmost:
db_data:
redis_data:`

And this is the error I get on startup:

db-1 | 2025-03-01 21:04:54.911 UTC [548] FATAL: password authentication failed for user "docmost"
db-1 | 2025-03-01 21:04:54.911 UTC [548] DETAIL: Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256"

Any ideas please?

Activity

  1. simowilso commented on Mar 3, 2025

    @simowilso
    Author

    Tried this, same result. I'm stuck: docker compose down --volumes and then docker compose up -d

  2. locked and limited conversation to collaborators on Mar 3, 2025
  3. converted this issue into a discussionon Mar 3, 2025
  4. converted this issue into a discussionon Mar 3, 2025
  5. Philipinho commented on Mar 3, 2025

    @Philipinho
    Member

    Trying to convert into a discussion but Github issue -> discussion conversion seems to be failing.

  6. Philipinho commented on Mar 3, 2025

    @Philipinho
    Member

    i. Do you have any data in your postgres database?
    ii. Do you have any special characters in your chosen password?

  7. unlocked this conversation on Mar 3, 2025
  8. simowilso commented on Mar 3, 2025

    @simowilso
    Author

    Hi - I think docker-compose down --volumes removes the database? If so then no there is no data in it.
    No special characters, simple 20 letter string

  9. simowilso commented on Mar 3, 2025

    @simowilso
    Author

    Here's the out put from a docker-compose up > log.log after removing volumes:

    Attaching to db-1, docmost-1, redis-1
    redis-1 | 1:C 03 Mar 2025 12:54:15.364 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see jemalloc/jemalloc#1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    redis-1 | 1:C 03 Mar 2025 12:54:15.367 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    redis-1 | 1:C 03 Mar 2025 12:54:15.367 * Redis version=7.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
    redis-1 | 1:C 03 Mar 2025 12:54:15.367 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
    redis-1 | 1:M 03 Mar 2025 12:54:15.368 * monotonic clock: POSIX clock_gettime
    redis-1 | 1:M 03 Mar 2025 12:54:15.369 * Running mode=standalone, port=6379.
    redis-1 | 1:M 03 Mar 2025 12:54:15.370 * Server initialized
    redis-1 | 1:M 03 Mar 2025 12:54:15.370 * Ready to accept connections tcp
    db-1 | The files belonging to this database system will be owned by user "postgres".
    db-1 | This user must also own the server process.
    db-1 |
    db-1 | The database cluster will be initialized with locale "en_US.utf8".
    db-1 | The default database encoding has accordingly been set to "UTF8".
    db-1 | The default text search configuration will be set to "english".
    db-1 |
    db-1 | Data page checksums are disabled.
    db-1 |
    db-1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
    db-1 | creating subdirectories ... ok
    db-1 | selecting dynamic shared memory implementation ... posix
    db-1 | selecting default max_connections ... 100
    db-1 | selecting default shared_buffers ... 128MB
    db-1 | selecting default time zone ... UTC
    db-1 | creating configuration files ... ok
    db-1 | running bootstrap script ... ok
    docmost-1 |
    docmost-1 | > [email protected] start /app
    docmost-1 | > pnpm --filter ./apps/server run start:prod
    docmost-1 |
    db-1 | performing post-bootstrap initialization ... ok
    docmost-1 |
    docmost-1 | > [email protected] start:prod /app/apps/server
    docmost-1 | > cross-env NODE_ENV=production node dist/main
    docmost-1 |
    db-1 | syncing data to disk ... ok
    db-1 |
    db-1 |
    db-1 | Success. You can now start the database server using:
    db-1 |
    db-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
    db-1 |
    db-1 | waiting for server to start....2025-03-03 12:54:18.456 UTC [40] LOG: starting PostgreSQL 16.8 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit
    db-1 | 2025-03-03 12:54:18.460 UTC [40] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    db-1 | 2025-03-03 12:54:18.472 UTC [43] LOG: database system was shut down at 2025-03-03 12:54:17 UTC
    db-1 | 2025-03-03 12:54:18.483 UTC [40] LOG: database system is ready to accept connections
    db-1 | done
    db-1 | server started
    db-1 | CREATE DATABASE
    db-1 |
    db-1 |
    db-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
    db-1 |
    db-1 | waiting for server to shut down....2025-03-03 12:54:18.747 UTC [40] LOG: received fast shutdown request
    db-1 | 2025-03-03 12:54:18.753 UTC [40] LOG: aborting any active transactions
    db-1 | 2025-03-03 12:54:18.759 UTC [40] LOG: background worker "logical replication launcher" (PID 46) exited with exit code 1
    db-1 | 2025-03-03 12:54:18.761 UTC [41] LOG: shutting down
    db-1 | 2025-03-03 12:54:18.764 UTC [41] LOG: checkpoint starting: shutdown immediate
    db-1 | 2025-03-03 12:54:19.071 UTC [41] LOG: checkpoint complete: wrote 924 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.233 s, sync=0.064 s, total=0.311 s; sync files=301, longest=0.009 s, average=0.001 s; distance=4267 kB, estimate=4267 kB; lsn=0/191AB10, redo lsn=0/191AB10
    db-1 | 2025-03-03 12:54:19.081 UTC [40] LOG: database system is shut down
    db-1 | done
    db-1 | server stopped
    db-1 |
    db-1 | PostgreSQL init process complete; ready for start up.
    db-1 |
    docmost-1 | [Nest] 42 - 03/03/2025, 12:54:22 PM LOG [NestFactory] Starting Nest application...
    docmost-1 | [Nest] 42 - 03/03/2025, 12:54:23 PM LOG [DatabaseModule] Establishing database connection
    docmost-1 | [Nest] 42 - 03/03/2025, 12:54:23 PM LOG [DatabaseModule] Retrying [1/15] in 3 seconds
    docmost-1 | [Nest] 42 - 03/03/2025, 12:54:26 PM LOG [DatabaseModule] Retrying [2/15] in 3 seconds
    docmost-1 | [Nest] 42 - 03/03/2025, 12:54:29 PM LOG [DatabaseModule] Retrying [3/15] in 3 seconds

  10. Philipinho commented on Mar 3, 2025

    @Philipinho
    Member

    Please provide the output of docker volume ls.

  11. simowilso commented on Mar 3, 2025

    @simowilso
    Author

    ubuntu@raspberrypi5:~/docmost$ sudo docker volume ls
    [sudo] password for ubuntu:
    DRIVER VOLUME NAME
    local 24c9e32a33a319160f656203fca3c08bccda9d4308f6505d8c38842836db07ed
    local 155de12ab4d8180bce3f9b192861be9d4bd66dca5dd49afe4ec4b74790f67490
    local 47911f291cbb4c6fbfeea80469ff33526932288b6de684b4a2aaa6e8fbe29522
    local 94637e06c0e99301a0b475d6caaf7cf9d347c61b0a154d93176bbc0eb9251502
    local 99610bc4fc14c7e457227ebfb00475967cfc8278dac7503e1fb56b9e0cbb47a5
    local docmost_db_data
    local docmost_docmost
    local docmost_redis_data
    local e8154634af3e36bf4254a8faebc8e70a867be355f29ca5323c16e9e0da64f063
    local edc2273b4c73afbd9f366a531f74645e44e03188e63c1cebbe23fa9fb88eb57e
    local fcab120b68c94c7c0311b06300679d8939948fcae377757069b4069217e4e5b0
    local immich_model-cache
    local portainer_data

  12. Philipinho commented on Mar 3, 2025

    @Philipinho
    Member

    DATABASE_URL: 'postgresql://docmost:@db:5432/docmost?schema=public'

    In your compose file, is this exactly how it is? do you have the DATABASE_URL password set?

  13. simowilso commented on Mar 3, 2025

    @simowilso
    Author

    It turns out there's some password length limit. I don't know what it is, my original password was around 20 chars, a shorter one is working.

  14. tmoehle commented on Mar 3, 2025

    @tmoehle

    I'm having the same issue with a 10 character password. Not sure this is solved.

  15. Philipinho commented on Mar 3, 2025

    @Philipinho
    Member

    @tmoehle please kindly create a new discussion.
    It’s more of a misconfiguration kind of problem.

  16. tmoehle commented on Mar 3, 2025

    @tmoehle

    @Philipinho I'm genuinely not sure, that this is true. Is the postgres database setup handled by some initial setup script in the docker container?

    I'm asking because according to the Installation Docs, all I have to do for inital setup is to fill the variables in the docker-compose.yml and I've tried it on two systems now, with exactly the same password in DATABASE_URL and POSTGRES_PASSWORD and I'm getting the same error.

    Not that I have any deeper knowledge of this software, but since I didn't configure the database directly, I can only assume some script must be taking the information in the docker compose file to set everything up. If there is a connection error then, this setup script would be the first place I'd look for a cause.

  17. Philipinho commented on Mar 3, 2025

    @Philipinho
    Member

    The Postgres image auto-creates the user and database on setup.
    Do you have special characters in your password?

    You should create a new discussion.

  18. arsaboo commented on Mar 25, 2025

    @arsaboo

    Avoid using special characters in the password field, and remove the files generated during your initial setup from the Docker volumes.

  19. MaRinobale commented on Nov 11, 2025

    @MaRinobale

    First,docker rm volume,then docker-compose up -d

  20. castrilllo commented on Jan 5, 2026

    @castrilllo

    hello, from my side I was working for a migration from a postgres_data volume to other. I was testing the data integrity into my localhost (by using podman). I got this error message any time I tried login into DB, error:

    2026-01-05 15:57:33.472 UTC [32] FATAL:  password authentication failed for user "postgres"
    �2026-01-05 15:57:33.472 UTC [32] DETAIL:  Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256"
    

    As I meanly use mariadb/mysql rather postgres I forgot about this file setup: pg_hba.conf

    I checked the postgres docu and by AI, and I could fix my issue.

    podman exec postgres sed -i '$c\host all all all trust' /var/lib/postgresql/data/pg_hba.conf
    
    podman exec -u postgres postgres psql -c "SELECT pg_reload_conf();"
    

    For sure the above workaround is not a solution, it's just for testing in dev/localhost env.

    hope it can be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions