Nextcloud 21 Internal Server Error

Nextcloud version: 21.0.2.1
Operating system and version: Ubuntu 20.04.2
Apache or nginx version: Apache 2.4.41
PHP version: 7.4.3
Based on NextcloudVM, so it auto updates.

The issue you are facing:

When logging in with LDAP user, I get

Internal Server Error
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.

If I log in with a local admin user I can log in, but if I attempt to get to settings, then that user also gets the same error.

The nextcloud.log notes some LDAP errors, and I’m not able to log in at all with an LDAP user, while I can at least somewhat get in with the builtin/local admin user. I’m wondering if perhaps I need to somehow temporarily disable LDAP. The problem is, if I go to settings with my local admin user I get the same error. I presume I’d have to do it in config files, but I don’t know where that would be done.

Since this is based on Nextcloud VM, it autoupdates. I’m not certain that it was an update that caused the issue.

Is this the first time you’ve seen this error? Y:

Steps to replicate it:

  1. attempt log in with non admin user

The output of your Nextcloud log in Admin > Logging:
N/A

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

<?php
$CONFIG = array (
  'passwordsalt' => 
  'secret' => '
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '
    2 => 'nextcloud',
    3 => 'nextcloud',
    4 => '
    5 => '
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '21.0.2.1',
  'overwrite.cli.url' => 'https://nextcloud/',
  'dbname' => '
  'dbhost' =>
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' =>
  'dbpassword' => '
  'installed' => true,
  'instanceid' => '
  'upgrade.disable-web' => 'true',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => '1800',
  'log_rotate_size' => '10485760',
  'trashbin_retention_obligation' => 'auto, 180',
  'versions_retention_obligation' => 'auto, 365',
  'simpleSignUpLink.shown' => 'false',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => '
  ),
  'logtimezone' => '
  'htaccess.RewriteBase' => '/',
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\MarkDown',
    5 => 'OC\\Preview\\MP3',
    6 => 'OC\\Preview\\TXT',
    7 => 'OC\\Preview\\Movie',
    8 => 'OC\\Preview\\Photoshop',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\TIFF',
  ),
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'maintenance' => false,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'app_install_overwrite' => 
  array (
    0 => 'files_photospheres',
  ),
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' =>
  'mail_from_address' => 
  'mail_domain' => '
  'mail_smtpauthtype' =>
  'mail_smtpauth' => 1,
  'mail_smtphost' => '
  'mail_smtpport' => '',
  'mail_smtpname' => '
  'mail_smtppassword' =>
  'updater.release.channel' => 'stable',
  'has_rebuilt_cache' => true,
  'default_phone_region' => 'us',
);

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

[Fri Jun 11 00:00:02.594691 2021] [ssl:warn] [pid 1201:tid 140181236554816] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jun 11 00:00:02.610620 2021] [mpm_event:notice] [pid 1201:tid 140181236554816] AH00489: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Jun 11 00:00:02.610639 2021] [core:notice] [pid 1201:tid 140181236554816] AH00094: Command line: '/usr/sbin/apache2'
[Fri Jun 11 14:29:36.683682 2021] [mpm_event:notice] [pid 1201:tid 140181236554816] AH00491: caught SIGTERM, shutting down
[Fri Jun 11 14:29:36.764815 2021] [ssl:warn] [pid 27324:tid 140167928757312] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jun 11 14:29:36.787814 2021] [ssl:warn] [pid 27339:tid 140167928757312] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jun 11 14:29:36.789074 2021] [mpm_event:notice] [pid 27339:tid 140167928757312] AH00489: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Jun 11 14:29:36.789096 2021] [core:notice] [pid 27339:tid 140167928757312] AH00094: Command line: '/usr/sbin/apache2'

Last few entries of nextcloud.log


sudo tail -n 2 /var/log/nextcloud/nextcloud.log | jq
{
  "reqId": "vHpNCC0JxIvOcVcBgk0K",
  "level": 2,
  "time": "2021-06-11T14:45:02-05:00",
  "remoteAddr": "",
  "user": "--",
  "app": "user_ldap",
  "method": "",
  "url": "--",
  "message": "Bind failed: 49: Invalid credentials",
  "userAgent": "--",
  "version": "21.0.2.1"
}
{
  "reqId": "vHpNCC0JxIvOcVcBgk0K",
  "level": 3,
  "time": "2021-06-11T14:45:02-05:00",
  "remoteAddr": "",
  "user": "--",
  "app": "core",
  "method": "",
  "url": "--",
  "message": {
    "Exception": "Exception",
    "Message": "LDAP Operations error",
    "Code": 1,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/LDAP.php",
        "line": 421,
        "function": "processLDAPError",
        "class": "OCA\\User_LDAP\\LDAP",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/LDAP.php",
        "line": 344,
        "function": "postFunctionCall",
        "class": "OCA\\User_LDAP\\LDAP",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/LDAP.php",
        "line": 212,
        "function": "invokeLDAPMethod",
        "class": "OCA\\User_LDAP\\LDAP",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "function": "read",
        "class": "OCA\\User_LDAP\\LDAP",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/Access.php",
        "line": 1099,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/Access.php",
        "line": 1103,
        "function": "OCA\\User_LDAP\\{closure}",
        "class": "OCA\\User_LDAP\\Access",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/Access.php",
        "line": 277,
        "function": "invokeLDAPMethod",
        "class": "OCA\\User_LDAP\\Access",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/Access.php",
        "line": 215,
        "function": "executeRead",
        "class": "OCA\\User_LDAP\\Access",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/User_LDAP.php",
        "line": 309,
        "function": "readAttribute",
        "class": "OCA\\User_LDAP\\Access",
        "type": "->"
      },
      {
        "function": "userExistsOnLDAP",
        "class": "OCA\\User_LDAP\\User_LDAP",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php",
        "line": 82,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/Proxy.php",
        "line": 169,
        "function": "walkBackends",
        "class": "OCA\\User_LDAP\\User_Proxy",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php",
        "line": 212,
        "function": "handleRequest",
        "class": "OCA\\User_LDAP\\Proxy",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php",
        "line": 188,
        "function": "userExistsOnLDAP",
        "class": "OCA\\User_LDAP\\User_Proxy",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/User/Manager.php",
        "line": 644,
        "function": "userExists",
        "class": "OCA\\User_LDAP\\User_Proxy",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php",
        "line": 90,
        "function": "callForSeenUsers",
        "class": "OC\\User\\Manager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/BackgroundJob/Job.php",
        "line": 52,
        "function": "run",
        "class": "OCA\\Files_Trashbin\\BackgroundJob\\ExpireTrash",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/BackgroundJob/TimedJob.php",
        "line": 59,
        "function": "execute",
        "class": "OC\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/cron.php",
        "line": 128,
        "function": "execute",
        "class": "OC\\BackgroundJob\\TimedJob",
        "type": "->"
      }
    ],
    "File": "/var/www/nextcloud/apps/user_ldap/lib/LDAP.php",
    "Line": 388,
    "CustomMessage": "Error while running background job (class: OCA\\Files_Trashbin\\BackgroundJob\\ExpireTrash, arguments: )"
  },
  "userAgent": "--",
  "version": "21.0.2.1"
}