Failed to load pending migrations: LogicException
Closed this issue · 2 comments
Describe the bug
Hello,
I'm seeing this log which seems to occur every time I load a page of the Web UI:
2024-06-30T19:01:55+02:00 - ERROR - Failed to load pending migrations: LogicException in /usr/share/icingaweb2/library/Icinga/Common/Database.php:28 with message: Please check if a db instance exists at all
I cannot access the "about" page, I get:
#0 /usr/share/icingaweb2/library/Icinga/Application/ProvidedHook/DbMigration.php(21): Icinga\Application\ProvidedHook\DbMigration->getWebDb()
#1 /usr/share/icingaweb2/library/Icinga/Application/Hook/DbMigrationHook.php(293): Icinga\Application\ProvidedHook\DbMigration->getDb()
#2 /usr/share/icingaweb2/library/Icinga/Application/Hook/DbMigrationHook.php(172): Icinga\Application\Hook\DbMigrationHook->load()
#3 /usr/share/icingaweb2/library/Icinga/Application/MigrationManager.php(306): Icinga\Application\Hook\DbMigrationHook->getMigrations()
#4 /usr/share/icingaweb2/library/Icinga/Application/MigrationManager.php(56): Icinga\Application\MigrationManager->load()
#5 /usr/share/icingaweb2/library/Icinga/Application/MigrationManager.php(106): Icinga\Application\MigrationManager->getPendingMigrations()
#6 /usr/share/icingaweb2/library/Icinga/Application/MigrationManager.php(69): Icinga\Application\MigrationManager->count()
#7 /usr/share/icingaweb2/application/views/scripts/about/index.phtml(99): Icinga\Application\MigrationManager->hasPendingMigrations()
#8 /usr/share/icingaweb2/library/Icinga/Web/View.php(235): include(String)
#9 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/View/Abstract.php(886): Icinga\Web\View->_run()
#10 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(910): Zend_View_Abstract->render()
#11 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(931): Zend_Controller_Action_Helper_ViewRenderer->renderScript()
#12 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(970): Zend_Controller_Action_Helper_ViewRenderer->render()
#13 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#14 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#15 /usr/share/icingaweb2/library/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch()
#16 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(954): Icinga\Web\Controller\Dispatcher->dispatch()
#17 /usr/share/icingaweb2/library/Icinga/Application/Web.php(294): Zend_Controller_Front->dispatch()
#18 /usr/share/icingaweb2/library/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
#19 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#20 {main}
To Reproduce
Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.
- Open any page of the Web interface
Expected behavior
No error log should be present.
Screenshots
N/A
Your Environment
I'm using a postgresl database with connection via a UNIX socket. I only have the "monitoring" module enabled.
- Icinga Web 2 version and modules (System - About): icinga-php-library 0.13.0, icinga-php-thirdparty 0.12.0, icingaweb2 2.12.1
- Web browser used: Firefox
- Icinga 2 version used (
icinga2 --version
): r2.14.2-1 - PHP version used (
php --version
): 8.3.8 - Server operating system and version: Gentoo ~arm64
Additional context
I just noticed that, under /config/general
, Configuration Database *
was unset so I set it. Now I'm getting this:
2024-06-30T19:12:42+02:00 - ERROR - PDOException in /usr/share/icinga-php/ipl/vendor/ipl/sql/src/Connection.php:402 with message: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "icingaweb_rememberme" does not exist
LINE 1: DELETE FROM icingaweb_rememberme WHERE expires_at < NOW()
I believe my database is lacking some tables for some reason? I'll try to check the repo to find out how to add them.
I assume my resources.ini
was utterly misconfigured. It was missing the credentials to access my icingaweb2
configuration database. I added the section, applied the migrations (starting with 2.5.0) and now everything works. I'll close this now.
Out of curiosity, is this what a normal resources.ini
should look like nowadays or is icinga_ido
deprecated. In which case, I assume I should migrate to https://github.com/Icinga/icingadb-web?
[icingaweb_db]
type = "db"
dbname = "icingaweb2"
[…]
[icinga_ido]
type = "db"
dbname = "icinga2"
[…]