Cron not running in NC 21.0.3

Until there is a fix available from Nextcloud, you could call the php commands with the parameter --define apc.enable_cli=1 e.g.:

sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ  maintenance:repair
2 Likes

I don’t think Nextcloud can provide a fix here. I’m pretty sure that the problem was caused by the PHP upgrade. Unfortunately, I can’t tell you for sure if all PHP settings were actually reset during the updgrade, because I didn’t check them all. As I already mentioned, I completely uninstalled PHP including all configuration files, and then reinstalled all PHP packages and made all relavant settings for PHP again.

After I did that, my Nextcloud and the cronjobs ran normally again, which leads me the conclusion, that the error must be caused by a missing PHP module or a wrong / missing PHP configuration and not by Nextcloud.

Thx bb77

I got cron errors on dashboard, but backup ran by cron always working.

This happened to me after upgrade to 21.0.3.
Using apache2 server and sury repos on RPi4.
Before running backup (script) i set NC to maintenance mode. This morning i got the appropriate APCU-error.
Adding “apc.enable_cli=1” to “apcu.ini” has done it for me. All running as expected again.

1 Like

Please note on my machine there was not any upgrade or change to the PHP 7.3.27 installation or the settings provided. This configuration allowed all Nextcloud versions before 21.0.3 running without the a.m. issue.

This points at NC 21.0.3 and some PHP code issue, I presume. Your mileage may vary.

Thanks a lot. I highly appreciate your contribution.

Based on your example I was able to pride a FIX to the cron configuration as follows.
Adding --define apc.enable_cli=1 to the www-data crontab:

$ sudo crontab -u www-data -e

*/5  *  *  *  * php -f /var/www/nextcloud/cron.php --define apc.enable_cli=1

This solves the issue on my machine and the NC cron job is available again.

However, there should be a more general fix provided by the NC devs hopefully as mentioned by me to @b77 before.

Happy hacking.

:sunflower:

3 Likes

the last Nextcloudupdates sucks… This was the reason, why i switched from OwnCloud to Nextcloud… :confused:

Anyway. Same Problem on Raspian (Debian) 10 with PHP 7.3 from the Repository.
This help:

after this, maybe you need also a reload of the Apache2 / Webserver like this one:
service apache2 reload
I’m not sure about it.

Thank You, Community!

4 Likes

Thanks to both @andrewheeler82 with 21.0.3 OC\HintException: Memcache \OC\Memcache\APCu not available · Issue #27781 · nextcloud/server · GitHub and @maysi2k and I sadly consent.

Apparently, the new Nextcloud policy is taking from big business now: “It’s not a bug it’s a feature.

https://docs.nextcloud.com/server/21/admin_manual/configuration_server/caching_configuration.html#id1

The admin manual has been changed to reflect this change of design only recently, I presume. This seems to be an intentional change to the PHP coding in NC 22 and obviously was backported to NC 21.0.3 without any notice to the community. Please prove me wrong, but this is my picture after reading the below reports which are one month old.

If this is the case, this apparent negligence and way of change from Nextcloud would be especially hurting to community people like me who were running a stable NC environment for years.

I had this setting configured before, so somewhere this must have been communicated. This is also the reason why I assumed that the upgrade of the PHP packages caused the error, because I had already made this confiiguration change before.

I’m not a developer and don’t understand half of the linked GitHub threads :wink: But it seems to me that APCu should be abandoned as the local cache and that Redis should be used for local caching to avoid problems in the future… Correct me if I’m misinterpreting this…

I think it’s a problem with the 21.0.3 update. Nothing above helps for me.
I decided to restore a backup with V 21.0.2. This works fine again. The problems with the cron’s and APCu begun with the update to V21.0.3.

I have another NC server which I updated from 20.0.11 to 21.0.3. Here I have no such problems with Cron and APCu.

How can someone understand such behaviour…

Best regards
DZ

Adding apc.enable_cli=1 to /etc/php/8.0/mods-available/apcu.ini worked for me as well

3 Likes

Then the two servers are not configured identically.

Unfortunately, I can’t say exactly what the problem was in my case, because as I mentioned earlier, I updated the PHP packages and then immediately updated to NC 21.0.3. Either the update of the PHP packages or the update of the Nexcloud obviously changed something in the PHP configuration. However, since I document all my installation steps and configurations, I was able to solve the problem in 5 minutes by simply reconfiguring PHP.

I updated only NC, no PHP update or anything and the error occured.
I went back to NC 21.0.2 with a backup and now it workls fine again.

I did some tests. I did a fresh installation of 21.0.3 on a second DiskStation (another Firmware version) and as soon as I enabled APCu the cron stopped. I did then a dffresh installation of 21.0.2 and the croin stayed intact after enabling APCu.

Here is the solution for Synology:
Create the file /usr/local/etc/php74/cli/conf.d/user_settings.ini with following content:

extension = apcu.so

[apc]
apc.shm_size = 512M
apc.enable_cli = 1

Thx to the guys from the German Synology Forum.

1 Like

So far I think it’s safe to say, that the parameter apc.enable_cli = 1 is mandatory for the cronjobs to continue to work if one uses APCu for local caching. In my opinion, however, this parameter has been recommended or even required for quite some time. It also says so in the documentation starting from v13… https://docs.nextcloud.com/server/13/admin_manual/configuration_server/caching_configuration.html#id1

1 Like

I have the same problem with Cron when migrating to 20.0.3. But I am running Nextcloud on a SYNOLOGY DSM. PHP 7.4, MariaDB 10, Apache2.4.
In WEB Station Configuration, PHP parameters, I gave to apc.enable_cli the value of 1 and it brakes instantly my Nextcloud Installation : internal server error.
I restored Nextcloud in 21.0.2 and Web Server in its previous configuration. It’s ok.
Is anyone using Synology and has changed apc.enable_cli to 1 with success ?
Thank you !

I posted the answer 2 posts above yours.

Thank you, but, it didn’t work for me…
I created the file
I migrated to NC 21.0.3
No error in Syno CRON JOB Task, but still the message in NC : an error occurred…
I modified apc.enable_cli=1 in webserver
Same message appeared : Internal Server Error

Thanks a lot!!
This solved my problem (php7.3.2 not updated) after updating to 21.0.3 on my machine as well.
I’m happy again.
BenBenna

Hello Pierre,
I also have a Synology with NextCloud, having the same issue (when I migrated to the 21.0.3 version).
The difference is that I migrated also to DSM 7
I changed the value apc.enable_cli=1 in WebStation. It didn’t break anything, but it didn’t either changed the cron from returning an error.
cheers,
Laurent.

Changing the value in the WebStation doesn’t help as it only applies to the Web Server. You have to create the config file for the cli.

Also restarting the DS might me neccessary.

1 Like

same problem here;
solution from @bb77 fixed the problem;

thx

1 Like