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

Repeated "Password authentication failed" on docker install #1011

Open
rogueai opened this issue Dec 12, 2023 · 4 comments
Open

Repeated "Password authentication failed" on docker install #1011

rogueai opened this issue Dec 12, 2023 · 4 comments

Comments

@rogueai
Copy link

rogueai commented Dec 12, 2023

Hi,

I'm experiencing several error messages in what seems to be the connection to the database. I'm running on docker using the provided compose template with koillection 1.4.13 and Postgres 16

From the start, it takes a few times for the container to connect to the db, it restarts a few times until it's finally able to authenticate. Docker logs report:

"An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "db" (10.0.5.14), port 5432 failed: FATAL:  password authentication failed for user "koillection""]

In ExceptionConverter.php line 77:

  An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "db" (10.0.5.14), port 5432 failed: FATAL:  password authentication failed for user "koillection"                                                 

In Exception.php line 28:

  SQLSTATE[08006] [7] connection to server at "db" (10.0.5.14), port 5432 failed: FATAL:  password authentication failed for user "koillection"           
                                                                        
In Driver.php line 34:
                                                                         
  SQLSTATE[08006] [7] connection to server at "db" (10.0.5.14), port 5432 failed: FATAL:  password authentication failed for user "koillection"    

Afer several container restarts, the server boots up and I'm able to register the first user, however i get seemingly random connection issues when navigating, here's a log after enabling app debug:

Doctrine\DBAL\Exception\ConnectionException:
An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "db" (10.0.5.14), port 5432 failed: FATAL:  password authentication failed for user "koillection"

  at vendor/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php:77
  at Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert()
     (vendor/doctrine/dbal/src/Connection.php:1935)
  at Doctrine\DBAL\Connection->handleDriverException()
     (vendor/doctrine/dbal/src/Connection.php:1884)
  at Doctrine\DBAL\Connection->convertException()
     (vendor/doctrine/dbal/src/Connection.php:377)
  at Doctrine\DBAL\Connection->connect()
     (vendor/doctrine/dbal/src/Connection.php:1652)
  at Doctrine\DBAL\Connection->getWrappedConnection()
     (vendor/doctrine/dbal/src/Connection.php:1079)
  at Doctrine\DBAL\Connection->executeQuery()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:771)
  at Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:241)
  at Doctrine\ORM\EntityRepository->findOneBy()
     (vendor/symfony/doctrine-bridge/Security/User/EntityUserProvider.php:54)
  at Symfony\Bridge\Doctrine\Security\User\EntityUserProvider->loadUserByIdentifier()
     (vendor/symfony/security-http/RememberMe/AbstractRememberMeHandler.php:63)
  at Symfony\Component\Security\Http\RememberMe\AbstractRememberMeHandler->consumeRememberMeCookie()
     (vendor/symfony/security-http/RememberMe/SignatureRememberMeHandler.php:63)
  at Symfony\Component\Security\Http\RememberMe\SignatureRememberMeHandler->consumeRememberMeCookie()
     (vendor/symfony/security-http/Authenticator/RememberMeAuthenticator.php:90)
  at Symfony\Component\Security\Http\Authenticator\RememberMeAuthenticator->Symfony\Component\Security\Http\Authenticator\{closure}()
     (vendor/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php:87)
  at Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge->getUser()
     (vendor/symfony/security-http/Authenticator/Passport/Passport.php:56)
  at Symfony\Component\Security\Http\Authenticator\Passport\Passport->getUser()
     (vendor/symfony/security-http/EventListener/UserCheckerListener.php:42)
  at Symfony\Component\Security\Http\EventListener\UserCheckerListener->preCheckCredentials()
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:220)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:56)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/symfony/security-http/Authentication/AuthenticatorManager.php:180)
  at Symfony\Component\Security\Http\Authentication\AuthenticatorManager->executeAuthenticator()
     (vendor/symfony/security-http/Authentication/AuthenticatorManager.php:158)
  at Symfony\Component\Security\Http\Authentication\AuthenticatorManager->executeAuthenticators()
     (vendor/symfony/security-http/Authentication/AuthenticatorManager.php:140)
  at Symfony\Component\Security\Http\Authentication\AuthenticatorManager->authenticateRequest()
     (vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php:40)
  at Symfony\Component\Security\Http\Firewall\AuthenticatorManagerListener->authenticate()
     (vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php:66)
  at Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener->authenticate()
     (vendor/symfony/security-bundle/Debug/WrappedLazyListener.php:46)
  at Symfony\Bundle\SecurityBundle\Debug\WrappedLazyListener->authenticate()
     (vendor/symfony/security-bundle/Security/LazyFirewallContext.php:60)
  at Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext->__invoke()
     (vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:80)
  at Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->callListeners()
     (vendor/symfony/security-http/Firewall.php:95)
  at Symfony\Component\Security\Http\Firewall->onKernelRequest()
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:220)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:56)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:197)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:29)
  at require_once('/var/www/koillection/vendor/autoload_runtime.php')
     (public/index.php:5)                
@benjaminjonard
Copy link
Owner

Hi, it looks like a problem with database credentials or with the database itself.

Could you please check if your database is properly running ? docker compose logs -f db should give you some informations

@brkr1
Copy link

brkr1 commented Apr 16, 2024

docker compose logs -f db

Same happens to me.

Here are the logs:

PostgreSQL Database directory appears to contain a database; Skipping initialization
db |
db | 2024-04-16 01:07:20.602 UTC [1] LOG: starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
db | 2024-04-16 01:07:20.603 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db | 2024-04-16 01:07:20.603 UTC [1] LOG: listening on IPv6 address "::", port 5432
db | 2024-04-16 01:07:20.609 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db | 2024-04-16 01:07:20.616 UTC [29] LOG: database system was shut down at 2024-04-16 01:07:19 UTC
db | 2024-04-16 01:07:20.624 UTC [1] LOG: database system is ready to accept connections
db | 2024-04-16 01:07:20.974 UTC [33] FATAL: password authentication failed for user "koillection"
db | 2024-04-16 01:07:20.974 UTC [33] DETAIL: Role "koillection" does not exist.
db | Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256"
db | 2024-04-16 01:07:21.654 UTC [34] FATAL: password authentication failed for user "koillection"
db | 2024-04-16 01:07:21.654 UTC [34] DETAIL: Role "koillection" does not exist.

@benjaminjonard
Copy link
Owner

I looks like a problem happened during the database container initialization. Could you try removing your database volume and then restarting the database container only with docker compose up db -d ?

@rodrigorega
Copy link

Same issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants