Background jobs wont run - Nextcloud 15

Nextcloud version (eg, 15.0.8):
Operating system and version (eg, Ubuntu 16.04 LTS):
Apache or nginx version (eg, Apache 2.4.18):
PHP version (eg, 7.3.5):

The issue you are facing:

crontab

service

timer

Is this the first time you’ve seen this error? (Y/N):
Yes

Steps to replicate it:
Don’t really know how to replicate it… It worked before I upgraded our server from 14 up to 15.

The output of your Nextcloud log in Admin > Logging:

I tried but it was over 1,3m characters with the log.. Can I upload only the log somehow?

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'instanceid',
  'passwordsalt' => 'passwordsalt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => 'IP-address',
    1 => 'nextcloud-test.company_domain.net',
    2 => 'nxtc-test.company_domain.net',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'mysql',
  'version' => '15.0.7.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextclouduser',
  'dbpassword' => 'password',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'ldapUserCleanupInterval' => 60,
  'overwrite.cli.url' => 'http://192.168.39.126',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'noreplynextcloud',
  'mail_domain' => 'company_domain.net',
  'mail_smtphost' => 'mailout-int.company_domain.net',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'mc727396',
  'mail_smtppassword' => 'password',
  'maintenance' => false,
  'log_type' => 'owncloud',
  'loglevel' => 3,
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'theme' => '',
  'updater.secret' => '$2y$10$EVH/uCf/H/kjxSrNlhAsQubCgLDbmX182mLQa6qQaX6Nh881VrgSi',
);

The output of your Apache/nginx/system log in /var/log/____:

Which log do you guys want?

I’m sorry, i’m not the best person to help you with your question…

But I noticed you shared your passwordsalt as well as your secret as well as your instanceid;

you should NEVER share this information with anyone; as well as your trusted_domains.

Be carefull with sharing information; only share information that is required to answer your question;).

I hope someone else is able to give you a correct answer.

::edit::

service

I noticed ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php
and in your config.php (nextcloud www directory) says your www-data directory is in www/html/nextcloud.

I suggest you should try to use:
ExecStart=/usr/bin/php -f /var/www/html/nextcloud/cron.php

Thanks for telling me, I forgot to change them, but the rest are just local addresses or changed domain names. So no worry there. :slight_smile:

I did just change it to ExecStart=/usr/bin/php -f /var/www/html/nextcloud/cron.php but still no luck… I did even run systemctl enable --now nextcloudcron.timer after.

I still had to configure the usage of cron instead of AJAX.

Your problem has to do with the combination of using systemd and cron…

I expect your using nextcloud on a small scale, so i recommend you to use the operating system cron instead of systemd as described in the link below:

https://docs.nextcloud.com/server/11/admin_manual/configuration_server/background_jobs_configuration.html

We have around 300 users but around 20-30 active users daily.

I have now deleted both nextcloudcron.timer and nextcloudcron.service. But still no cronjob that is running.

Logs would help.
Select cron, wait a while. Post logs from last hour. Nextcloud.log and logs from /var/log/.

Sorry for asking, but what do you mean with “Select cron, wait a while”?

I think you’re using ajax atm, because cron isn’t working. So, change to cron and let it run.

I can only find /var/log/nextcloud/nextcloud.log which is 42k characters (Last entry was 24/5), so can’t really upload it here.
What should the other file be?

kern.log and syslog may show something.

Hello.

This is from the Syslog… I can’t get anything from the kern.log

Jun  7 10:00:01 NextCloud sSMTP[113931]: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384
Jun  7 10:00:01 NextCloud cron[1248]: sendmail: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:00:01 NextCloud sSMTP[113931]: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:00:01 NextCloud CRON[113928]: (www-data) MAIL (mailed 31 bytes of output but got status 0x0001 from MTA#012)
Jun  7 10:00:01 NextCloud sSMTP[113934]: Creating SSL connection to host
Jun  7 10:00:01 NextCloud sSMTP[113934]: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384
Jun  7 10:00:02 NextCloud cron[1248]: sendmail: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:00:02 NextCloud sSMTP[113934]: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:00:02 NextCloud CRON[113929]: (www-data) MAIL (mailed 2222 bytes of output but got status 0x0001 from MTA#012)
Jun  7 10:00:10 NextCloud systemd[1]: Started Session 8959 of user company_name.
Jun  7 10:03:21 NextCloud systemd[1]: Started Nextcloud cron.php job.
Jun  7 10:03:21 NextCloud php[114056]: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/html/nextcloud/lib/private/DB/Connection.php:64
Jun  7 10:03:21 NextCloud php[114056]: Stack trace:
Jun  7 10:03:21 NextCloud php[114056]: #0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
Jun  7 10:03:21 NextCloud php[114056]: #1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
Jun  7 10:03:21 NextCloud php[114056]: #2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
Jun  7 10:03:21 NextCloud php[114056]: #3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
Jun  7 10:03:21 NextCloud php[114056]: #4 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
Jun  7 10:03:21 NextCloud php[114056]: #5 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driv in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
Jun  7 10:03:21 NextCloud php[114056]: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/html/nextcloud/lib/private/DB/Connection.php:64
Jun  7 10:03:21 NextCloud php[114056]: Stack trace:
Jun  7 10:03:21 NextCloud php[114056]: #0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
Jun  7 10:03:21 NextCloud php[114056]: #1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
Jun  7 10:03:21 NextCloud php[114056]: #2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
Jun  7 10:03:21 NextCloud php[114056]: #3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
Jun  7 10:03:21 NextCloud php[114056]: #4 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
Jun  7 10:03:21 NextCloud php[114056]: #5 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driv in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
Jun  7 10:03:21 NextCloud systemd[1]: nextcloudcron.service: Main process exited, code=exited, status=255/n/a
Jun  7 10:03:21 NextCloud systemd[1]: nextcloudcron.service: Unit entered failed state.
Jun  7 10:03:21 NextCloud systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Jun  7 10:05:01 NextCloud CRON[114071]: (www-data) CMD (php-cli -f /var/www/html/nextcloud/cron.php)
Jun  7 10:05:01 NextCloud CRON[114072]: (www-data) CMD (php -f /var/www/html/nextcloud/cron.php)
Jun  7 10:05:01 NextCloud sSMTP[114073]: Creating SSL connection to host
Jun  7 10:05:01 NextCloud sSMTP[114073]: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384
Jun  7 10:05:01 NextCloud cron[1248]: sendmail: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:05:01 NextCloud cron[1248]: sendmail: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:05:01 NextCloud sSMTP[114075]: RCPT TO:<postmaster@NextCloud> (504 5.5.2 <root@NextCloud>: Sender address rejected: need fully-qualified address)
Jun  7 10:05:01 NextCloud CRON[114070]: (www-data) MAIL (mailed 2222 bytes of output but got status 0x0001 from MTA#012)
Jun  7 10:08:21 NextCloud systemd[1]: Started Nextcloud cron.php job.
Jun  7 10:08:21 NextCloud php[114076]: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/html/nextcloud/lib/private/DB/Connection.php:64
Jun  7 10:08:21 NextCloud php[114076]: Stack trace:
Jun  7 10:08:21 NextCloud php[114076]: #0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
Jun  7 10:08:21 NextCloud php[114076]: #1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
Jun  7 10:08:21 NextCloud php[114076]: #2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
Jun  7 10:08:21 NextCloud php[114076]: #3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
Jun  7 10:08:21 NextCloud php[114076]: #4 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
Jun  7 10:08:21 NextCloud php[114076]: #5 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driv in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
Jun  7 10:08:21 NextCloud php[114076]: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/html/nextcloud/lib/private/DB/Connection.php:64
Jun  7 10:08:21 NextCloud php[114076]: Stack trace:
Jun  7 10:08:21 NextCloud php[114076]: #0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
Jun  7 10:08:21 NextCloud php[114076]: #1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()

Any ideas?

Well, it says it can’t connect to the database. Do you have the same modules enabled for php-cli?

The thing is that it worked before I upgraded to Nextcloud 15. but what do you mean with “same modules enabled for php-cli”? Same as what? :stuck_out_tongue:

The php config your webserver is using.

This one is solved, but Don’t remember how.

I just think I updated the crontab for www-data and used php over php-cli.