r/BookStack • u/briddums • Jul 10 '25
Error when upgrading
I recently tried upgrading my BookStack docker container. I did so via Portainer by clicking on the Update the Stack button.
When my BookStack instance restarted I got a 500 Server Error when I connected to the site. Looking at the laravel.log there is an error in there.
I was wondering if anyone else had encountered this error before? Any ideas on how to fix it?
[2025-05-22 07:41:01] production.ERROR: SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select exists (select 1 from information_schema.tables where table_schema = 'bookstackapp' and table_name = 'migrations' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) as \exists`) {"exception":"[object] (Illuminate\Database\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select exists (select 1 from information_schema.tables where table_schema = 'bookstackapp' and table_name = 'migrations' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) as `exists`) at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:825)`
[stacktrace]
#0 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(979): Illuminate\\Database\\Connection->runQueryCallback()
#1 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(958): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection()
#2 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(781): Illuminate\\Database\\Connection->handleQueryException()
#3 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(398): Illuminate\\Database\\Connection->run()
#4 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(344): Illuminate\\Database\\Connection->select()
#5 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(361): Illuminate\\Database\\Connection->selectOne()
#6 /app/www/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(45): Illuminate\\Database\\Connection->scalar()
#7 /app/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(184): Illuminate\\Database\\Schema\\MySqlBuilder->hasTable()
#8 /app/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(742): Illuminate\\Database\\Migrations\\DatabaseMigrationRepository->repositoryExists()
#9 /app/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(165): Illuminate\\Database\\Migrations\\Migrator->repositoryExists()
#10 /app/www/vendor/laravel/framework/src/Illuminate/Support/helpers.php(338): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#11 /app/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(165): retry()
#12 /app/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(141): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->repositoryExists()
#13 /app/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(111): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->prepareDatabase()
#14 /app/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(658): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#15 /app/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(110): Illuminate\\Database\\Migrations\\Migrator->usingConnection()
#16 /app/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(89): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->runMigrations()
#17 /app/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle()
#18 /app/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#19 /app/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
#20 /app/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#21 /app/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(696): Illuminate\\Container\\BoundMethod::call()
#22 /app/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\\Container\\Container->call()
#23 /app/www/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#24 /app/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\\Component\\Console\\Command\\Command->run()
#25 /app/www/vendor/symfony/console/Application.php(1094): Illuminate\\Console\\Command->run()
#26 /app/www/vendor/symfony/console/Application.php(342): Symfony\\Component\\Console\\Application->doRunCommand()
#27 /app/www/vendor/symfony/console/Application.php(193): Symfony\\Component\\Console\\Application->doRun()
#28 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(198): Symfony\\Component\\Console\\Application->run()
#29 /app/www/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#30 {main}
View all comments
Show parent comment
1
u/ssddanbrown Jul 10 '25
You need to pin your database container version to use mariadb
10.5.16. So, something likeghcr.io/linuxserver/mariadb:10.5.16for the image. Then start up the database so it can attempt to fix itself.That is quite an old version though, is this an old setup? Might want to backup all volume files first though.
Generally, you need to be really careful of updating database containers. Avoid automated updates. Ensure full careful shutdown before upgrading and restarting. Since this is a few years old, it might be wise to carefully jump up database container versions via an intermediate version or two, although I'm not totally sure on that.