ERROR while initializing the database : Failling installation of Nextcloud 25.0.2.3 with Postgres 15.1

Hi everyone,
I have a bug during the installation process of my Nextcloud instance (using a postgres database as backend, both being managed through kubernetes).
Both container start without problems and seems to be configured to “talk” with each other, but for some reason, the nextcloud instance has trouble using de postgres backend. I had several bug and this is the last bug I encountered (and restarting/recreating the containers don’t change anything).

Here’s the log from Nextcloud

Initializing nextcloud 25.0.2.3 ...
New nextcloud instance
Installing with PostgreSQL database
Starting nextcloud installation
Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "oc_appconfig" does not exist
LINE 1: SELECT * FROM "oc_appconfig"
                      ^
Trace: #0 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1780): Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query))
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1719): Doctrine\DBAL\Connection->handleDriverException(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query))
#2 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1067): Doctrine\DBAL\Connection->convertExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDO\Exception), 'SELECT * FROM "...', Array, Array)
#3 /var/www/html/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM "...', Array, Array, NULL)
#4 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery('SELECT * FROM "...', Array, Array)
#5 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(281): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/html/lib/private/AppConfig.php(415): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/html/lib/private/AppConfig.php(222): OC\AppConfig->loadConfigValues()
#8 /var/www/html/lib/private/AllConfig.php(217): OC\AppConfig->getValue('core', 'vendor', '')
#9 /var/www/html/lib/private/DB/MigrationService.php(118): OC\AllConfig->getAppValue('core', 'vendor', '')
#10 /var/www/html/lib/private/DB/MigrationService.php(182): OC\DB\MigrationService->createMigrationTable()
#11 /var/www/html/lib/private/DB/MigrationService.php(255): OC\DB\MigrationService->getMigratedVersions()
#12 /var/www/html/lib/private/DB/MigrationService.php(433): OC\DB\MigrationService->getMigrationsToExecute('latest')
#13 /var/www/html/lib/private/DB/MigrationService.php(408): OC\DB\MigrationService->migrateSchemaOnly('latest')
#14 /var/www/html/lib/private/Setup/AbstractDatabase.php(153): OC\DB\MigrationService->migrate('latest', true)
#15 /var/www/html/lib/private/Setup.php(371): OC\Setup\AbstractDatabase->runMigrations()
#16 /var/www/html/core/Command/Maintenance/Install.php(105): OC\Setup->install(Array)
#17 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Maintenance\Install), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/console.php(100): OC\Console\Application->run()
#23 /var/www/html/occ(11): require_once('/var/www/html/c...')
#24 {main}

Here’s the log from Postgres :

2023-01-13 10:39:32.208 UTC [135] ERROR:  relation "oc_appconfig" does not exist at character 15
2023-01-13 10:39:32.208 UTC [135] STATEMENT:  SELECT * FROM "oc_appconfig"

This seems to indicate me that nextcloud and postgres are configured correctly.

And this is what I’ve done with the Postgres to prepare it for the nextcloud :

CREATE USER nextcloud;
ALTER USER nextcloud PASSWORD '<nextcloud_password>';
CREATE DATABASE nextcloud_db;
ALTER DATABASE nextcloud_db OWNER TO nextcloud;
GRANT ALL PRIVILEGES ON DATABASE nextcloud_db TO nextcloud;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO nextcloud;

Do I need to upload my manifest files to give more info?

Thanks for your help ! :smiley:

Sorry i can not really help you. But i found this issue for you. Maybe you must only delete config.php and reinstall. But the solving ist not the solving of the issue starter.

Also i found this issue but it is ore for migration of database owner.

Hi!

It didn’t seem to work.

I entered the container, deleted the file and then ran ./occ -vvv maintenance:install while looking at the logs of the nextcloud container and postgres and nothing was visible in the logs.

I took a look at the nextcloud_db, and saw only one empty table (oc_migrations), creating a user didn’t seems to change anything to the database too, so I don’t really know if this fixed the bug.

This need further testing from my part, I’ll keep you posted on this ! (trying to restart the instance, removing from outside the container, etc)

Thanks for your answer!