Nextcloud cron job error while upgrading nethserver-nextcloud (Failed to connect to the database)


I received a cron error notification this morning. It seems that something went wrong after yum autoupdated nethserver-nextcloud :

Cron <apache@cloud> /usr/bin/scl enable rh-php73 -- php -d memory_limit=512M -d apc.enable_cli=1 -f /usr/share/nextcloud/cron.php
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/share/nextcloud/lib/private/DB/Connection.php:87
Stack trace:
#0 /usr/share/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()
#1 /usr/share/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1145): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /usr/share/nextcloud/lib/private/DB/Connection.php(267): Doctrine\DBAL\Connection->executeStatement('DELETE FROM `oc...', Array, Array)
#3 /usr/share/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\DB\Connection->executeStatement('DELETE FROM `oc...', Array, Array)
#4 /usr/share/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /usr/share/nextcloud/lib/private/BackgroundJob/JobList.php(110): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /usr/share/nextcloud/apps/settings/lib/BackgroundJobs/VerifyUserData.php(99): OC\BackgroundJob\JobList->remove(Object(OCA\Settings\BackgroundJobs\VerifyUserData), '{"verificationC...')
#7 /usr/share/nextcloud/cron.php(127): OCA\Settings\BackgroundJobs\VerifyUserData->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
#8 {main}

Any idea ? My other more recently installed server updated without a hitch.

Does Nextcloud still work? Does the database exist?

/opt/rh/rh-mariadb105/root/bin/mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "show databases;"

Did you already try to run the cronjob manually?

sudo -u apache scl enable rh-php73 -- php -d memory_limit=512M -d apc.enable_cli=1 -f /usr/share/nextcloud/cron.php

If this error just occurs once, it could be an issue that mariadb not started or restarting, see Problems with Nextcloud - #23 by dnutan

1 Like

Sorry forgot to say that my instance is still working.

Launched the cron job manually : no error or whatsoever reported.

I didn’t thought about MariaDB restarting. I guess you’re right, and in that case it would be a temporary glitch.

Txs !

1 Like

Follow up : i noticed that after the update some calendars sharing settings were not working anymore. I had to unshare and share again.

Not sure that the problems are linked though.