sysPass icon indicating copy to clipboard operation
sysPass copied to clipboard

Database error during installation

Open robonaj opened this issue 4 years ago • 5 comments

sysPass Version docker.io/syspass/syspass 3.2.2 docker.io/mariadb 10.6.4

Describe the bug After filling in all fields of the installation page of a fresh sysPass docker container in the browser and clicking the install button, an error is displayed instead of the installation being successful (from the log):

syspass.EXCEPTION: logger {"message":"SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table
syspass.EXCEPTION: logger {"message":"Error while setting the database permissions ('SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table

To Reproduce Steps to reproduce the behavior:

  1. Start sysPass in Docker:
docker network create syspass-net

docker run --name syspass-db \
--network syspass-net \
--restart unless-stopped \
--env MYSQL_ROOT_PASSWORD=syspass \
--volume /srv/syspass/db-data:/var/lib/mysql:z \
--detach mariadb:10.6.4

docker run --name syspass-app \
--network syspass-net \
--publish 8000:80 \
--restart unless-stopped \
--volume /srv/syspass/app-config:/var/www/html/sysPass/app/config:z \
--volume /srv/syspass/app-backup:/var/www/html/sysPass/app/backup:z \
--detach syspass/syspass:3.2.2
  1. Open sysPass in a browser http://localhost:8000
  2. Fill the installation page forms using the following for the DB configuration:
    • DB access user: root
    • DB access password: syspass
    • sysPass database name: syspass
    • sysPass database server: syspass-db
  3. Hit the "INSTALL" button

Expected behavior Being logged in to the database as the root user, the sysPass installation should be able to create the user and permission it needs for the database access and conclude the installation as successful.

Screenshots image

Event log From the start until the relevant exceptions (with most stack traces omitted):

[2021-10-04 20:04:37] syspass.EXCEPTION: logger {"message":"Context not initialized
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Config file created","caller":"SP\Config\Config::initialize"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.EXCEPTION: logger {"message":"File not found (/var/www/html/sysPass/app/cache/icons.cache)
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Saved icons cache","caller":"SP\Core\UI\Theme::saveIcons"}
[2021-10-04 20:04:37] syspass.ERROR: logger {"message":"Not installed","caller":"SP\Modules\Web\Init::initialize"}
[2021-10-04 20:04:37] syspass.EXCEPTION: logger {"message":"File not found (/var/www/html/sysPass/app/cache/actions.cache)
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"ACTION CACHE MISS","caller":"SP\Core\Acl\Actions::mapAndSave"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Saved actions cache","caller":"SP\Core\Acl\Actions::saveCache"}
[2021-10-04 20:04:37] syspass.EXCEPTION: logger {"message":"Response is locked
[2021-10-04 20:04:37] syspass.EXCEPTION: logger {"message":"Response is locked
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:37] syspass.EXCEPTION: logger {"message":"File not found (/var/www/html/sysPass/app/config/pubkey.pem)
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:37] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:38] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:04:38] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:04:38] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:04:38] syspass.EXCEPTION: logger {"message":"Unable to connect to DB
[2021-10-04 20:04:38] syspass.EXCEPTION: logger {"message":"Unable to connect to DB
[2021-10-04 20:04:38] syspass.EXCEPTION: logger {"message":"(P) Unable to connect to DB
[2021-10-04 20:04:38] syspass.EXCEPTION: logger {"message":"Unable to connect to DB
[2021-10-04 20:04:38] syspass.EXCEPTION: logger {"message":"(P) Unable to connect to DB
[2021-10-04 20:10:07] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-10-04 20:10:07] syspass.INFO: logger {"message":"Loaded icons cache","caller":"SP\Core\UI\Theme::initIcons"}
[2021-10-04 20:10:07] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-10-04 20:10:07] syspass.EXCEPTION: logger {"message":"SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table
#0 /var/www/html/sysPass/lib/SP/Services/Install/MySQL.php(253): PDO->exec(String)
#1 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(279): SP\Services\Install\MySQL->createDatabase()
#2 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(187): SP\Services\Install\Installer->setupDb()
#3 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#4 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#5 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#6 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)
#7 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#8 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#9 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route),Object(Klein\DataCollection\RouteCollection),Array)
#10 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#11 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap->run(Object(DI\Container))
#12 /var/www/html/sysPass/index.php(28): require(String)","caller":"N/A"}
[2021-10-04 20:10:07] syspass.EXCEPTION: logger {"message":"Error while setting the database permissions ('SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table')
#0 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(279): SP\Services\Install\MySQL->createDatabase()
#1 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(187): SP\Services\Install\Installer->setupDb()
#2 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#3 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#4 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#5 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)
#6 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#7 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#8 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route),Object(Klein\DataCollection\RouteCollection),Array)
#9 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#10 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap->run(Object(DI\Container))
#11 /var/www/html/sysPass/index.php(28): require(String)","caller":"N/A"}
[2021-10-04 20:10:07] syspass.EXCEPTION: logger {"message":"(P) SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table
#0 /var/www/html/sysPass/lib/SP/Services/Install/MySQL.php(253): PDO->exec('GRANT ALL PRIVI...')
#1 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(279): SP\Services\Install\MySQL->createDatabase()
#2 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(187): SP\Services\Install\Installer->setupDb()
#3 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#4 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#5 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#6 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)
#7 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#8 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#9 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#10 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#11 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#12 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#13 {main}","caller":"N/A"}
[2021-10-04 20:10:20] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[...]

Platform:

  • OS: Linux/Docker
  • OS Version:
    • Host: CentOS 7.9
    • Syspass container: Debian 10 (buster)
  • Browser: Firefox 92.0.1

Additional context Running mysql inside the syspass-app container shows that the connection to the database works fine:

[me@server]$ sudo docker exec -ti syspass-app bash
root@92e56d1cd72a:/# apt-get install default-mysql-client
root@92e56d1cd72a:/# mysql --host=syspass-db --password=syspass
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.6.4-MariaDB-1:10.6.4+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

robonaj avatar Oct 07 '21 20:10 robonaj

+1

emersonarredondo avatar Jan 05 '22 16:01 emersonarredondo

Hello,

It's a weird issue, could you test it using MariaDB 10.3?

Regards

nuxsmin avatar Mar 13 '22 20:03 nuxsmin

Hi,

Thank you for your suggestion. It does work with MariaDB 10.3. Please let us know if you know how we could make it work with a recent MariaDB (maybe manually setting up something first). If not, I'll just use 10.3 for now and find out how to migrate in a year when 10.3 reaches end-of-support.

Regards and a thank you for the work you have done and provided us with!

robonaj avatar Apr 10 '22 20:04 robonaj

+1

I've modified the compose file to use the latest images, so SysPass v3.2.11 and MariaDB 10.9.2 (jammy) Error message is the same:

Error while setting the database permissions ('SQLSTATE[28000]: Invalid authorization specification: 1133 Can't find any matching row in the user table')
Please check the database user permissions

When trying to login to the MariaDB server using docker exec -it xyz bash followed by a mysql -u root -p using the password specified in the docker-compose file ("syspass"), access is working fine:

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED BY PASSWORD '*27C96A835B8CF7FF2E5BE080EAAAF05F93F3C0F6' WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                          |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.000 sec)

1-am-r00t avatar Aug 31 '22 16:08 1-am-r00t

+1

Arash9703 avatar Oct 29 '23 08:10 Arash9703