matteo-convertino / otpmanager-nextcloud

Nextcloud app that allows you to manage your OTP (TOTP/HOTP) codes easily
GNU Affero General Public License v3.0
25 stars 5 forks source link

An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist #46

Closed Cisco30 closed 4 months ago

Cisco30 commented 4 months ago

I am trying to install the OTP Manager application, but the database is not created, I see the following error in Nextcloud: Nextcloud: 28.0.5 MariaDB 11.2.3 Debian 12 Php 8.2.18 OTP Manager : 0.5.3 Thanks for your help

DbalException
An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist
/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php
Ligne 328
OC\DB\Exceptions\DbalException::wrap()
/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php
Ligne 137
OC\DB\QueryBuilder\QueryBuilder->executeStatement()
/var/www/nextcloud/apps/otpmanager/lib/Controller/PasswordController.php
Ligne 51
OCP\AppFramework\Db\QBMapper->insert()
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php
Ligne 230
OCA\OtpManager\Controller\PasswordController->get()
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php
Ligne 137
OC\AppFramework\Http\Dispatcher->executeController()
/var/www/nextcloud/lib/private/AppFramework/App.php
Ligne 184
OC\AppFramework\Http\Dispatcher->dispatch()
/var/www/nextcloud/lib/private/Route/Router.php
Ligne 315
OC\AppFramework\App::main()
/var/www/nextcloud/lib/base.php
Ligne 1069
OC\Route\Router->match()
/var/www/nextcloud/index.php
Ligne 39
OC::handleRequest()
Causé par TableNotFoundException
An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist
Entrée brute dans le journal
{
  "reqId": "4HrLx9rNVgRU0PpLCB15",
  "level": 3,
  "time": "2024-05-09T09:40:05+00:00",
  "remoteAddr": "192.168.1.254",
  "user": "Boubou",
  "app": "index",
  "method": "GET",
  "url": "/apps/otpmanager/password",
  "message": "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "version": "28.0.5.1",
  "exception": {
    "Exception": "OC\\DB\\Exceptions\\DbalException",
    "Message": "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist",
    "Code": 1146,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 328,
        "function": "wrap",
        "class": "OC\\DB\\Exceptions\\DbalException",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
        "line": 137,
        "function": "executeStatement",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/otpmanager/lib/Controller/PasswordController.php",
        "line": 51,
        "function": "insert",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "get",
        "class": "OCA\\OtpManager\\Controller\\PasswordController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php",
    "Line": 71,
    "Previous": {
      "Exception": "Doctrine\\DBAL\\Exception\\TableNotFoundException",
      "Message": "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist",
      "Code": 1146,
      "Trace": [
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1938,
          "function": "convert",
          "class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1880,
          "function": "handleDriverException",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1208,
          "function": "convertExceptionDuringQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
          "line": 294,
          "function": "executeStatement",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
          "line": 386,
          "function": "executeStatement",
          "class": "OC\\DB\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 280,
          "function": "execute",
          "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 326,
          "function": "execute",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
          "line": 137,
          "function": "executeStatement",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/otpmanager/lib/Controller/PasswordController.php",
          "line": 51,
          "function": "insert",
          "class": "OCP\\AppFramework\\Db\\QBMapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 230,
          "function": "get",
          "class": "OCA\\OtpManager\\Controller\\PasswordController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 137,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 315,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1069,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 39,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",
      "Line": 49,
      "Previous": {
        "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
        "Message": "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist",
        "Code": 1146,
        "Trace": [
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
            "line": 132,
            "function": "new",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
            "type": "::"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
            "line": 1202,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
            "line": 294,
            "function": "executeStatement",
            "class": "Doctrine\\DBAL\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
            "line": 386,
            "function": "executeStatement",
            "class": "OC\\DB\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 280,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 326,
            "function": "execute",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
            "line": 137,
            "function": "executeStatement",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/apps/otpmanager/lib/Controller/PasswordController.php",
            "line": 51,
            "function": "insert",
            "class": "OCP\\AppFramework\\Db\\QBMapper",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 230,
            "function": "get",
            "class": "OCA\\OtpManager\\Controller\\PasswordController",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 137,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
            "line": 184,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Route/Router.php",
            "line": 315,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::"
          },
          {
            "file": "/var/www/nextcloud/lib/base.php",
            "line": 1069,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/index.php",
            "line": 39,
            "function": "handleRequest",
            "class": "OC",
            "type": "::"
          }
        ],
        "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
        "Line": 28,
        "Previous": {
          "Exception": "PDOException",
          "Message": "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist",
          "Code": "42S02",
          "Trace": [
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
              "line": 130,
              "function": "execute",
              "class": "PDOStatement",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
              "line": 1202,
              "function": "execute",
              "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
              "line": 294,
              "function": "executeStatement",
              "class": "Doctrine\\DBAL\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
              "line": 386,
              "function": "executeStatement",
              "class": "OC\\DB\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
              "line": 280,
              "function": "execute",
              "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
              "line": 326,
              "function": "execute",
              "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
              "line": 137,
              "function": "executeStatement",
              "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/apps/otpmanager/lib/Controller/PasswordController.php",
              "line": 51,
              "function": "insert",
              "class": "OCP\\AppFramework\\Db\\QBMapper",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
              "line": 230,
              "function": "get",
              "class": "OCA\\OtpManager\\Controller\\PasswordController",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
              "line": 137,
              "function": "executeController",
              "class": "OC\\AppFramework\\Http\\Dispatcher",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
              "line": 184,
              "function": "dispatch",
              "class": "OC\\AppFramework\\Http\\Dispatcher",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Route/Router.php",
              "line": 315,
              "function": "main",
              "class": "OC\\AppFramework\\App",
              "type": "::"
            },
            {
              "file": "/var/www/nextcloud/lib/base.php",
              "line": 1069,
              "function": "match",
              "class": "OC\\Route\\Router",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/index.php",
              "line": 39,
              "function": "handleRequest",
              "class": "OC",
              "type": "::"
            }
          ],
          "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
          "Line": 130
        }
      }
    },
    "message": "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist",
    "exception": [],
    "CustomMessage": "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_otpmanager_settings' doesn't exist"
  },
  "id": "663c99fcad0f3"
}
matteo-convertino commented 4 months ago

Are you trying to do the first clean install, or is it an upgrade? You don't have any saved accounts yet right? If so then I would advise you to delete all the OTP Manager data that will have been automatically stored and try again. You should run these commands directly in the MariaDB shell:

DROP TABLE oc_otpmanager_accounts;
DROP TABLE oc_otpmanager_settings;
DROP TABLE oc_otpmanager_shared;
DELETE FROM oc_migrations WHERE app="otpmanager";
DELETE FROM oc_appconfig WHERE appid="otpmanager";
Cisco30 commented 4 months ago

thank you very much for the quick response! Your solution worked:

DELETE FROM oc_migrations WHERE app="otpmanager";
DELETE FROM oc_appconfig WHERE appid="otpmanager";

OTP Manager had already been installed, but I had a problem following an update. Everything is working perfectly again. Thank you very much.