Cronjob is running and lastcron is updated in DB but NC says last cron was more than a day ago

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 32.0.x):
    • 32.0.6
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04
  • Web server and version (e.g, Apache 2.4.25):
    • 2.4.58
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • HAProxy 2.8.16
  • PHP version (e.g, 8.3):
    • 8.4
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • Yesterday
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare Metal/LXC
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • Mod-security

Summary of the issue you are facing:

Some jobs have not been executed since one day siden. Please consider increasing the execution frequency.

What I have done:
1:
delete from public.oc_appconfig
where appid = 'core'
and configkey like '%lastcron%';
DELETE 1

SELECT * from public.oc_appconfig
where appid = 'core'
and configkey like '%lastcron%';
appid | configkey | configvalue | type | lazy
-------+-----------+-------------+------+------
(0 rows)

As expected, I now has “Background job has not been run yet!”

2:
sudo -u www-data php -f /var/www/nextcloud/cron.php

SELECT * from public.oc_appconfig
where appid = 'core'
and configkey like '%lastcron%';
appid | configkey | configvalue | type | lazy
-------+-----------+-------------+------+------
core | lastcron | 1772446640 | 8 | 0
(1 row)

And I got:

Some jobs have not been executed since one day siden. Please consider increasing the execution frequency.

Steps to replicate it (hint: details matter!):

  1. Steps are litterally explained above

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

{"reqId":"FhQpTDp5GgBKRX5F8xM1","level":0,"time":"2026-03-02T10:41:58+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","scriptName":"/var/www/nextcloud/cron.php","message":"dirty table reads: SELECT * FROM `*PREFIX*jobs` WHERE (`reserved_at` <= :dcValue1) AND (`last_checked` <= :dcValue2) AND (`time_sensitive` = :dcValue3) ORDER BY `last_checked` ASC LIMIT 1","userAgent":"--","version":"32.0.6.1","occ_command":["/var/www/nextcloud/cron.php"],"exception":{"Exception":"Exception","Message":"dirty table reads: SELECT * FROM `*PREFIX*jobs` WHERE (`reserved_at` <= :dcValue1) AND (`last_checked` <= :dcValue2) AND (`time_sensitive` = :dcValue3) ORDER BY `last_checked` ASCLIMIT 1","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":50,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":291,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":196,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":157,"function":"getNext","class":"OC\\BackgroundJob\\JobList","type":"->"}],"File":"/var/www/nextcloud/lib/private/DB/Connection.php","Line":407,"message":"dirty table reads: SELECT * FROM `*PREFIX*jobs` WHERE (`reserved_at` <= :dcValue1) AND (`last_checked` <= :dcValue2) AND (`time_sensitive` = :dcValue3) ORDER BY `last_checked` ASC LIMIT 1","tables":["oc_appconfig","oc_jobs","oc_collectives_sessions","oc_user_status"],"reads":["oc_jobs"],"exception":{},"CustomMessage":"dirty table reads: SELECT * FROM `*PREFIX*jobs` WHERE (`reserved_at` <= :dcValue1) AND (`last_checked` <= :dcValue2) AND (`time_sensitive` = :dcValue3) ORDER BY `last_checked` ASC LIMIT 1"}}

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "version": "32.0.6.1",
        "overwrite.cli.url": "https:\/\/mydomain.dom",
        "htaccess.RewriteBase": "\/",
        "overwriteprotocol": "https",
        "installed": true,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "data-fingerprint": "d518a5c48eb3e1f261fdacc48e7aae9e",
        "default_phone_region": "DK",
        "maintenance": false,
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [
            "admin",
            "NCNoMFA"
        ],
        "share_folder": "\/Delinger",
        "loglevel": 0,
        "app_install_overwrite": {
            "1": "cas",
            "2": "otpmanager",
            "3": "secrets",
            "4": "cfg_share_links",
            "6": "files_texteditor",
            "7": "side_menu"
        },
        "theme": "",
        "memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/exiftool-amd64-glibc",
        "memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-amd64",
        "maintenance_window_start": 1,
        "memories.db.triggers.fcu": true,
        "allow_local_remote_servers": true,
        "filelocking.enabled": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "dbtype": "pgsql",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "5432",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "mydomain.dom",
            "127.0.0.1",
            "class a IP",
            "localhost",
            "myotherdomain.dom"
        ],
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "pipe",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpstreamoptions": {
            "ssl": {
                "allow_self_signed": true,
                "verify_peer": false,
                "verify_peer_name": false
            }
        },
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "1025",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "app.mail.verify-tls-peer": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "defaultapp": "",
        "twofactor_enforced_excluded_groups=admin": ""
    }
}

Apps

The output of occ app:list (if possible).

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

I didn’t check the db for the last Cronjob run, but I have the same problem with an almost similar setup. The Cron Job itself seems to start, it is shown when I look at it via systemctl status cron.

I just noticed taht toady after Update to 32.0.6, but the Cloud said the Job did run last two month ago. So I would be interested in some hints too.

1 Like

Some more: I get an error message about missing php modules now; this happemd first after my previous post. Nevertheless I installed the missing modules, but the error message still exists. mbstring, GD, cURL were missing for PHP 8.4 (and 8.5…). So now?

I found a solution: Set the Cron job to explicitly use a PHP version that’s compatible with Nextcloud. My system updated itself to PHP 8.5 (don’t remember when…). I changed the crontab now to

* * * * * /usr/bin/php8.4 -f /path/to/your/nextcloud/cron.php

and the job started again, also delivering missing notifications. The error ist gone now, nevertheless there is still the message taht some jobs didn’t run for 3 month now. But tehre are other automated background jobs that also may have stopped cause of the wrong php version, but those jobs don’t depend on the cron settings. So I’ll wait at least until tomorrow if those message will also dissapear.

2 Likes

Yeah that did it. Thank you. I do not know what happened. This is the excact way my cronjob has been for ages (I actually changes it to the specific version even, when I upgrades PHP version). I tested with

root@nc:~# sudo -u www-data php -v
PHP 8.4.18 (cli) (built: Feb 13 2026 16:00:19) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.18, Copyright (c) Zend Technologies
with Zend OPcache v8.4.18, Copyright (c), by Zend Technologies
root@nc:~#

Hence the use of the php without full path, should be good enough. For some reason, then even when the above is good and well, running the following did not work:

sudo -u www-data php -f /var/www/nextcloud/cron.php

But this one did:

sudo -u www-data /usr/bin/php8.4 -f /var/www/nextcloud/cron.php

There should not be any difference. However, thank you. It did solve my issue.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.