nextcloud: cronjob breaks nextcloud configuration

Description

cron.php included with nextcloud gets executed periodically. If there is no configuration (e.g. after instalation) it somehow fails with following output and creates empty config.php.

HBS (5.1.10)

May  5 20:40:01 turris crond[24321]: (nobody) CMD (/usr/bin/php-cli -f /srv/www/nextcloud/cron.php)
May  5 20:40:01 turris crond[24319]: (nobody) CMDOUT (PHP Warning:  fileperms(): stat failed for /srv/www/nextcloud/data/nextcloud.log in /srv/www/nextcloud/lib/private/Log/File.php on line 83)
May  5 20:40:01 turris crond[24319]: (nobody) CMDOUT ({"reqId":"2LX5Nd3mNTNs08DNy0G1","level":3,"time":"2021-05-05T20:40:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for /srv/www/nextcloud/data/nextcloud.log at /srv/www/nextcloud/lib/private/Log/File.php#83","userAgent":"--","version":""})
May  5 20:40:01 turris crond[24319]: (nobody) CMDOUT ({"reqId":"2LX5Nd3mNTNs08DNy0G1","level":3,"time":"2021-05-05T20:40:01+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/srv/www/nextcloud/lib/base.php","line":651,"function":"checkInstalled","class":"OC","type":"::","args":[]},{"file":"/srv/www/nextcloud/lib/base.php","line":1089,"function":"init","class":"OC","type":"::","args":[]},{"file":"/srv/www/nextcloud/cron.php","line":42,"args":["/srv/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/srv/www/nextcloud/lib/base.php","Line":282,"CustomMessage":"--"},"userAgent":"--","version":""})
May  5 20:40:01 turris crond[24319]: (nobody) CMDOUT (PHP Warning:  fileperms(): stat failed for /srv/www/nextcloud/data/nextcloud.log in /srv/www/nextcloud/lib/private/Log/File.php on line 83)
May  5 20:40:01 turris crond[24319]: (nobody) CMDOUT ({"reqId":"2LX5Nd3mNTNs08DNy0G1","level":3,"time":"2021-05-05T20:40:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for /srv/www/nextcloud/data/nextcloud.log at /srv/www/nextcloud/lib/private/Log/File.php#83","userAgent":"--","version":""})
May  5 20:40:01 turris crond[24319]: (nobody) CMDOUT ({"reqId":"2LX5Nd3mNTNs08DNy0G1","level":3,"time":"2021-05-05T20:40:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"chmod(): No such file or directory at /srv/www/nextcloud/lib/private/Log/File.php#84","userAgent":"--","version":""})

HBT (5.2.0)

May  5 21:15:01 turris crond[25474]: (nobody) CMD (/usr/bin/php-cli -f /srv/www/nextcloud/cron.php)
May  5 21:15:02 turris crond[25472]: (nobody) CMDOUT ({"reqId":"W0nzxPKvqhxjJgLWjROt","level":3,"time":"2021-05-05T21:15:02+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/srv/www/nextcloud/lib/base.php","line":654,"function":"checkInstalled","class":"OC","type":"::","args":[]},{"file":"/srv/www/nextcloud/lib/base.php","line":1095,"function":"init","class":"OC","type":"::","args":[]},{"file":"/srv/www/nextcloud/cron.php","line":42,"args":["/srv/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/srv/www/nextcloud/lib/base.php","Line":282,"CustomMessage":"--"},"userAgent":"--","version":""})

Expected behaviour

No config.php should exist and user should be able to configure nextcloud from Foris.

Actual behaviour

Empty config.php is created as side effect, thus from foris point of view it looks like nextcloud is already configured.

In order to be able to configure nextcloud from Foris, it is necessary to remove /srv/www/nextcloud/config/config.php.

Edited by Martin Matějek