[BUG] Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
saveli opened this issue · 10 comments
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Use nextcloud as you would usually - after a timeout run into this error:
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
Expected Behavior
I can use nextcloud normally again
Steps To Reproduce
Try to use/connect to nextcloud
Environment
- OS: Unraid 6.12.11
- How docker service was installed: Unraid community apps
CPU architecture
x86-64
Docker creation
docker run
-d
--name='nextcloud'
--net='br0'
--ip='<ip4>'
--ip6='<ip6>'
-e TZ="Europe/Berlin"
-e HOST_OS="Unraid"
-e HOST_HOSTNAME="<host>"
-e HOST_CONTAINERNAME="nextcloud"
-e 'TCP_PORT_443'='443'
-e 'PUID'='99'
-e 'PGID'='100'
-e 'UMASK'='022'
-l net.unraid.docker.managed=dockerman
-l net.unraid.docker.webui='https://[IP]:[PORT:443]'
-l net.unraid.docker.icon='https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/nextcloud-logo.png'
-v '/mnt/user/data/nextcloud':'/data':'rw'
-v '/mnt/user/appdata/nextcloud':'/config':'rw' 'lscr.io/linuxserver/nextcloud'
542b2a9c2cee55511a0660107c62db1c22aa92d20fdf6377d8d1c24a0e3754d0
Container logs
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
───────────────────────────────────────
██╗ ███████╗██╗ ██████╗
██║ ██╔════╝██║██╔═══██╗
██║ ███████╗██║██║ ██║
██║ ╚════██║██║██║ ██║
███████╗███████║██║╚██████╔╝
╚══════╝╚══════╝╚═╝ ╚═════╝
Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID: 99
User GID: 100
───────────────────────────────────────
Linuxserver.io version: 29.0.5-ls336
Build-date: 2024-08-27T11:51:40+00:00
───────────────────────────────────────
using keys found in /config/keys
Initializing nextcloud 29.0.5.1 (this can take a while) ...
Setting permissions
Initializing finished
After completing the web-based installer, restart the Nextcloud container to apply default memory caching and transactional file locking configurations.
Alternatively, you can apply your own configurations by editing /config/www/nextcloud/config/config.php following the documentation:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html
https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/files_locking_transactional.html
[custom-init] No custom files found, skipping...
[ls.io-init] done.
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(709): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1184): OC::init()
#14 /app/www/public/cron.php(58): require_once('...')
#15 {main}
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(709): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1184): OC::init()
#14 /app/www/public/cron.php(58): require_once('...')
#15 {main}
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(709): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1184): OC::init()
#14 /app/www/public/cron.php(58): require_once('...')
#15 {main}
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(709): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1184): OC::init()
#14 /app/www/public/cron.php(58): require_once('...')
#15 {main}
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(709): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1184): OC::init()
#14 /app/www/public/cron.php(58): require_once('...')
#15 {main}
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /app/www/public/lib/private/DB/Connection.php:167
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(709): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1184): OC::init()
#14 /app/www/public/cron.php(58): require_once('...')
#15 {main}
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.
That's saying it's unable to connect to your database, if you're running mariadb or postgres, I would check they're working.
Yes, apparently.
But mariadb doesn't show any errors nor fitting entries in the log.
Only thing, that happened, was a server restart.
I checked anything obvious what could have changed, passwords, ports, and so on... I have no clue what causes this.
Any way to get more detailed logs?
It seems to be a timeout, not a "conn refused" or "password wrong"?
Just noticed you're using br0 - you really shoudn't be using that network mode nor do we recommend it. by default that network mode blocks communication for the container from the rest of the host. Seems like your issue is how you've configured your containers on unraid.
I had it working absolutely fine for weeks with br0, so it gets an own IP adress and nginx proxy to it.
Where else would you place it? It requires ports 80/443, so Host or Bridge network is a no-go.
So something would've changed in your unraid system which would be blocking this.
There is no need to use br0 networking. While yes you do get port conflicts (just use different port numbers) when using docker networking, you can still use the normal ports when the containers are communicating via the docker network so that traffic stays within your host.
With what you've currently done, traffic is leaving and entering your server.
eth0 is bridged to br0, so that's not a problem (and it used to work).
Any way to get more detailed logs on what's happening exactly?
Your container is unable to talk with your database container, your host is blocking it. I would suggest not using br0 network to test.
We don't recommend using br0. Users are more than welcome to do whatever networking solution they want (no reason why it doesn't work with br0) but we aren't going to support it as it has variables on how your host is setup.
And in terms of getting more details of logs, no.
Got it working again - host traffic pointed me in the right direction.
You'll find posts on it at least since Unraid 6.8.2:
After a reboot, Host access to custom networks
is disabled, despite showing Enabled
.
That is also why I did not check networking when showing no change and being on Enabled
, and why it used to work before the mentioned restart. Nextcloud was the only affected container, hence I came here 😁
Anyhow, if you suffer from the same issue, go to settings and without changing anything, just stop and start docker service, and host access will work again, until the next reboot.
Case closed, thanks!