[SOLVED] Upgrade from Nextcloud 21 -> 22, can't log in, "Class 'OCP\\User' not found"

Support intro
The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.

Technical details
Remote Address: 10.1.3.131
Request ID: CLxK5ScodMFrmwewtdGx

Logs:

{
  "reqId": "CLxK5ScodMFrmwewtdGx",
  "level": 3,
  "time": "2021-10-28T15:22:03+00:00",
  "remoteAddr": "10.1.3.131",
  "user": "6c7cc23e-52c9-103b-8e51-0fc031bcb58e",
  "app": "index",
  "method": "GET",
  "url": "/nextcloud/index.php/apps/dashboard/",
  "message": "Class 'OCP\\User' not found",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
  "version": "22.2.0.2",
  "exception": {
    "Exception": "Error",
    "Message": "Class 'OCP\\User' not found",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/epubreader/lib/Hooks.php",
        "line": 41,
        "function": "get",
        "class": "OCA\\Epubreader\\Config",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 106,
        "function": "announce_settings",
        "class": "OCA\\Epubreader\\Hooks",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Template/JSConfigHelper.php",
        "line": 323,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/TemplateLayout.php",
        "line": 220,
        "function": "getConfig",
        "class": "OC\\Template\\JSConfigHelper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Template.php",
        "line": 182,
        "function": "__construct",
        "class": "OC\\TemplateLayout",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/public/AppFramework/Http/TemplateResponse.php",
        "line": 204,
        "function": "fetchPage",
        "class": "OC_Template",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 171,
        "function": "render",
        "class": "OCP\\AppFramework\\Http\\TemplateResponse",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 156,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 301,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1000,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/epubreader/lib/config.php",
    "Line": 28,
    "CustomMessage": "--"
  }
}


Nextcloud version (eg, 20.0.5): 22.2.0.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 21.10
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.46 (Ubuntu)
PHP version (eg, 7.4): 7.4.21

The issue you are facing:

Following the upgrade from nextcloud 21 to 22, I am getting “Internal Server Error” before I even get a login prompt. If I understand the logs correctly, I think that means it’s the “epubreader” app? If that’s correct, how do I disable that? Do I just remove it from the array in config.php?

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

Steps to replicate it:

  1. Upgrade to nextcloud 22.2.0.2 from 21
  2. Navigate to the login screen

The output of your Nextcloud log in Admin > Logging:

N/A can't log in

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

<?php
$CONFIG = array (
  'instanceid' => '---',
  'passwordsalt' => '---',
  'secret' => '---',
  'trusted_domains' => 
  array (
    0 => '---.---.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.0.2',
  'overwrite.cli.url' => 'https://---.---.com/nextcloud',
  'dbname' => 'hda_nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'usr_hda_nextcloud',
  'dbpassword' => '---',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => '',
  'log_type' => "file",
  'logfile' => "nextcloud.log",
  'loglevel' => 2,
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '---.---.com',
  'mail_smtphost' => '127.0.0.1',
  'mail_smtpport' => '25',
  'app_install_overwrite' => 
  array (
    0 => 'breezedark',
    1 => 'epubreader',
    2 => 'printer',
  ),
  'default_phone_region' => 'US',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'updater.secret' => '---',
);

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

[Thu Oct 28 08:22:03.409931 2021] [php7:notice] [pid 1098] [client 10.1.3.131:45482] {"reqId":"CLxK5ScodMFrmwewtdGx","level":3,"time":"2021-10-28T15:22:03+00:00","remoteAddr":"10.1.3.131","user":"6c7cc23e-52c9-103b-8e51-0fc031bcb58e","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/dashboard/","message":"Module 'ldap' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36","version":"22.2.0.2"}
[Thu Oct 28 08:22:05.176493 2021] [php7:notice] [pid 1099] [client 10.1.3.131:45484] {"reqId":"B2InuOC4SCPo78DmXG2N","level":3,"time":"2021-10-28T15:22:05+00:00","remoteAddr":"10.1.3.131","user":"6c7cc23e-52c9-103b-8e51-0fc031bcb58e","app":"PHP","method":"GET","url":"/nextcloud/index.php/apps/recommendations/api/recommendations/always","message":"Module 'ldap' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36","version":"22.2.0.2"}
[Thu Oct 28 08:22:05.578538 2021] [php7:notice] [pid 1104] [client 10.1.3.131:45486] {"reqId":"fbv7FPuca0gVmLKly87A","level":3,"time":"2021-10-28T15:22:05+00:00","remoteAddr":"10.1.3.131","user":"6c7cc23e-52c9-103b-8e51-0fc031bcb58e","app":"PHP","method":"GET","url":"/nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications","message":"Module 'ldap' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36","version":"22.2.0.2"}
{"reqId":"9ozXsL4MrMJSLN6b3oOs","level":3,"time":"2021-10-28T15:34:07+00:00","remoteAddr":"10.1.3.131","user":"6c7cc23e-52c9-103b-8e51-0fc031bcb58e","app":"PHP","method":"GET","url":"/nextcloud/index.php/csrftoken","message":"Module 'ldap' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36","version":"22.2.0.2"}

I solved this by disabling the 3 apps listed in the config:

root@hda:/var/www/nextcloud/config# sudo -u www-data php /var/www/nextcloud/occ app:disable epubreader
epubreader 1.4.6 disabled
root@hda:/var/www/nextcloud/config# sudo -u www-data php /var/www/nextcloud/occ app:disable breezedark
breezedark 22.0.2 disabled
root@hda:/var/www/nextcloud/config# sudo -u www-data php /var/www/nextcloud/occ app:disable printer
printer 0.0.5 disabled

It seems that incompatible apps aren’t auto disabled and can break the install after an upgrade.

1 Like