Nextcloud 21 Missing autoload.php

Nextcloud version (eg, 20.0.5): 20.0.7 -> 21
Operating system and version: Ubuntu 20.10
Apache or nginx version (eg, Apache 2.4.25): official docker image version of Apache
PHP version (eg, 7.4): official docker image php version

The issue you are facing: Errors when trying to connect to Nextcloud or run occ commands.

root@RockPIX:~# docker exec --user www-data nextcloud php occ
PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5

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

Steps to replicate it:

  1. Run Nextcloud 20.0.7
  2. dc down; docker pull nextcloud; dc up -d #dc is an alias for docker-compose
  3. See above error

The output of your Nextcloud log in Admin > Logging:

Can't login to check

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

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oc733yn47f5n',
  'passwordsalt' => '**********************',
  'secret' => '**************************************',
  'trusted_domains' =>
  array (
    0 => '13.13.33.221',
    1 => 'nextcloud.********.com',
  ),
  'trusted_proxies' =>
  array (
    0 => '13.13.33.193',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '20.0.7.1',
  'overwrite.cli.url' => 'http://13.13.33.221',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '********',
  'installed' => true,
  'has_rebuilt_cache' => true,
  'loglevel' => 0,
  'maintenance' => false,
);

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

[Sat Mar 06 17:17:29.659649 2021] [php7:error] [pid 31] [client 13.13.33.193:43496] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
[Sat Mar 06 17:17:29.660767 2021] [php7:error] [pid 28] [client 13.13.33.193:43492] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - - [06/Mar/2021:17:17:29 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
13.13.33.193 - - [06/Mar/2021:17:17:29 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
13.13.33.193 - - [06/Mar/2021:17:17:29 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
[Sat Mar 06 17:17:29.669690 2021] [php7:error] [pid 29] [client 13.13.33.193:43494] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - - [06/Mar/2021:17:17:29 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
[Sat Mar 06 17:17:29.675436 2021] [php7:error] [pid 30] [client 13.13.33.193:43498] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - - [06/Mar/2021:17:17:29 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
[Sat Mar 06 17:20:00.735378 2021] [php7:error] [pid 32] [client 13.13.33.193:43614] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
[Sat Mar 06 17:20:00.736302 2021] [php7:error] [pid 31] [client 13.13.33.193:43616] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - - [06/Mar/2021:17:20:00 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
13.13.33.193 - - [06/Mar/2021:17:20:00 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"
[Sat Mar 06 17:20:05.446615 2021] [php7:error] [pid 38] [client 13.13.33.193:43622] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - valon [06/Mar/2021:17:20:05 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications?format=json HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Linux) mirall/3.1.3git (build 4849) (Nextcloud)"
[Sat Mar 06 17:25:05.511787 2021] [php7:error] [pid 28] [client 13.13.33.193:43842] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - valon [06/Mar/2021:17:25:05 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications?format=json HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Linux) mirall/3.1.3git (build 4849) (Nextcloud)"
[Sat Mar 06 17:26:03.486905 2021] [php7:error] [pid 29] [client 13.13.33.193:43888] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/custom_apps/mail/vendor/composer/autoload_real.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps') in /var/www/html/custom_apps/mail/vendor/autoload.php on line 5
13.13.33.193 - - [06/Mar/2021:17:26:03 +0000] "GET /index.php/204 HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.15.0"

Great job on Nextcloud! Keep up the good work everyone!

Good News, Everyone! I fixed it. And since I hate finding posts online where they stop there, I’m actually going to fill you in on what happened.

So I looked at the error and figured that it was probably something to do with the new version not liking the mail app. I went into the custom_apps folder and moved the mail directory somewhere else for backup. When I did that and restarted the docker container, the update page came up and I was able to click to start the upgrade.

After the updater checked all the apps for updates, it tried to check the mail app. It looked like it succeeded, but then the updater errored out and the server went into maintenance mode.

From there, I logged into the server and ran the occ update commands. It took a while, but it just worked after that.