Hi together,
I recently had to restart my system which acts as docker host for my Nextcloud setup. When, the containers were recreated, the following error occured. Possibly slightly newer images (patch versions) were pulled.
nextcloud_1 | Initializing nextcloud 28.0.2.5 ...
nextcloud_1 | New nextcloud instance
nextcloud_1 | Installing with PostgreSQL database
nextcloud_1 | => Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/pre-installation
nextcloud_1 | Starting nextcloud installation
nextcloud_1 | Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[42501]: Insufficient privilege: 7 ERROR: permission denied for table oc_migrations
nextcloud_1 | Trace: #0 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(295): OC\DB\Exceptions\DbalException::wrap(Object(Doctrine\DBAL\Exception\DriverException))
nextcloud_1 | #1 /var/www/html/lib/private/DB/MigrationService.php(188): OC\DB\QueryBuilder\QueryBuilder->executeQuery()
nextcloud_1 | #2 /var/www/html/lib/private/DB/MigrationService.php(255): OC\DB\MigrationService->getMigratedVersions()
nextcloud_1 | #3 /var/www/html/lib/private/DB/MigrationService.php(417): OC\DB\MigrationService->getMigrationsToExecute('latest')
nextcloud_1 | #4 /var/www/html/lib/private/DB/MigrationService.php(394): OC\DB\MigrationService->migrateSchemaOnly('latest')
nextcloud_1 | #5 /var/www/html/lib/private/Setup/AbstractDatabase.php(159): OC\DB\MigrationService->migrate('latest', true)
nextcloud_1 | #6 /var/www/html/lib/private/Setup.php(376): OC\Setup\AbstractDatabase->runMigrations(NULL)
nextcloud_1 | #7 /var/www/html/core/Command/Maintenance/Install.php(113): OC\Setup->install(Array, NULL)
nextcloud_1 | #8 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\Maintenance\Install->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_1 | #9 /var/www/html/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_1 | #10 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Maintenance\Install), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_1 | #11 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_1 | #12 /var/www/html/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_1 | #13 /var/www/html/console.php(100): OC\Console\Application->run()
nextcloud_1 | #14 /var/www/html/occ(11): require_once('/var/www/html/c...')
nextcloud_1 | #15 {main}
The database container show the following log at this time:
postgres_1 | 2024-03-17 20:00:25.088 UTC [82] ERROR: permission denied for table oc_migrations
postgres_1 | 2024-03-17 20:00:25.088 UTC [82] STATEMENT: SELECT "version" FROM "oc_migrations" WHERE "app" = $1 ORDER BY "version" ASC
Using the configured database user I am successfully able to execute the select and I retrieve results. Also, before restarting the host it worked properly as well.
For reference my compose file:
volumes:
postgres:
nextcloud:
services:
postgres:
image: postgres
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres:/var/lib/postgresql/data
ports:
- 5432:5432
nextcloud:
build: ./build
restart: always
depends_on:
- postgres
links:
- postgres
environment:
POSTGRES_HOST: postgres
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN}
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
NEXTCLOUD_ENABLED_APPS: groupfolders,keeweb,passwords
NEXTCLOUD_DISABLED_APPS: circles,comments,logreader,user_status,weather_status,dashboard,contactsinteraction,federation,nextcloud_announcements,recommendations,related_resources,serverinfo,sharebymail,support,survey_client,systemtags,updatenotification,firstrunwizard
NEXTCLOUD_USERS_GROUP: users
NEXTCLOUD_USERS: xxxxxxxxxxxxxxxxxxxxxxx
NEXTCLOUD_USERS_PASSWORD: ${NEXTCLOUD_USERS_PASSWORD}
NEXTCLOUD_USERS_MEDIA_DIRECTORY: /media
NEXTCLOUD_SHARED_DIRECTORIES: software=users,media=users
volumes:
- nextcloud:/var/www/html/data
- ./hooks/post-installation:/docker-entrypoint-hooks.d/post-installation
- ./scripts:/scripts
ports:
- 80:80
- 443:443
Don’t be confused with some custom variables, they are evaluated during the post installation step by a couple self-written scripts, but this should not interfer as my nextcloud container does not even pass the installation step.
I would greatly appreciate any help or pointers how I could analyze this problem further as I am currently not able to boot back in. Alternatively, I could only reupload on a fresh instance, but this would take some time, plus I am curious on the issue for problems in the future.
Kind regards
Adagatiya