Cron.php failing because base.php is not installed

I am running Nextcloud via the Nextcloud docker image. This is how my docker compose file looks like

// other settings
nextcloud:
image: nextcloud:17-apache
container_name: nextcloud
depends_on:
  - nextcloud_db
  - nextcloud_redis
volumes:
  - ${DATADIR}/nextcloud/custom_apps:/var/www/html/custom_apps
  - ${DATADIR}/nextcloud/config:/var/www/html/config
  - ${DATADIR}/nextcloud/data:/var/www/html/data
  - ${DATADIR}/nextcloud/themes:/var/www/html/themes
  - ${DATADIR}/nextcloud/www:/var/www/html
restart: unless-stopped
networks:
  - nextcloud_network
  - traefik_proxy
labels:
// ... Traefik

cron:
image: nextcloud:17-apache
restart: unless-stopped
entrypoint: /cron.sh
volumes:
  - ${DATADIR}/nextcloud/www:/var/www/html
  - ${DATADIR}/nextcloud/data:/var/www/html/data
depends_on:
  - nextcloud_db
  - nextcloud_redis
networks:
  - nextcloud_network
// db and other stuff

Mostly everything seems to work fine but cron is not. It never runs and I find these errors in the logs:

Exception: Not installed
/var/www/html/lib/base.php - line 646:

OC::checkInstalled()

/var/www/html/lib/base.php - line 1078:

OC::init()

/var/www/html/cron.php - line 41:

require_once("/var/www/html/lib/base.php")

I jumped into the container and the base.php file seems to be there

www-data@735905f1a3f0:~/html$ ls -lah /var/www/html/lib/
total 111K
drwxr-xr-x  6 www-data root    9 May 30 11:35 .
drwxr-xr-x 15 www-data root   29 May 30 11:35 ..
-rw-r--r--  1 www-data root 5.4K May 30 11:35 autoloader.php
-rw-r--r--  1 www-data root  36K May 30 11:35 base.php
drwxr-xr-x  3 www-data root    4 May 30 11:35 composer
drwxr-xr-x  2 www-data root  190 May 30 11:35 l10n
drwxr-xr-x 58 www-data root  100 May 30 11:35 private
drwxr-xr-x 49 www-data root  105 May 30 11:35 public
-rw-r--r--  1 www-data root  615 May 30 11:35 versioncheck.php

My config.php also contains 'installed' => true,

If I manually run cron.php from within the container nothing seems to happen, no output, the task just keeps running until I hit ctrl+C. Why is it not working? What am I missing here?

For what user did you set up the cron job? It has to be www-data in your case.

As you can see in the docker-compose file I am calling the file from the cron.sh. It is taken from the official example here. Do I need to add any user config there? I thought the docker image is using www-data as a default

@LastSamurai , did you ever figure this one out? I’m getting the same error on 21.0.2

Hi,
Almost same issue with NC25.01
PHP Warning: require_once(*******/cloud/lib/base.php): Failed to open stream: No such file or directory in *****/cloud/console.php on line 48

I’ve been having the same problem. and think it has to do with the cron image not thinking NextCloud is installed.

On the cron image, if I run docker exec -u www-data -it nextcloud-cron ./occ -V to show the NextCloud version, I get this message:

Nextcloud is not installed - only a limited number of commands are available
Nextcloud 23.0.12

But running the same command on the app image, it finds NextCloud and shows:

Custom Cloud Name 23.0.12

This seems like something is missing in the cron container to tell OCC that NextCloud is installed.

Since I also followed the official docker-compose documentation on NextCloud’s GitHub, it seems that if this is the standard behavior and something needs to be change, then it should be documented.

How can we get this to work?

The cron image seems to be working now.
The clue was on GitHub.
I just had to make sure all networks and volumes are shared between the main NextCloud image and the cron image.

Unfortunately in the the NextCloud settings, it still says:

Background jobs
Last job execution ran 3 hours ago. Something seems wrong.

Is this the correct behavior, since we’re running the cron job from another container?

EDIT: After a few hours, it all appears to be running fine.