LDAP Remnant List still contains users which have already been deleted via occ delete command

Nextcloud version (eg, 20.0.5): 21.0.3.1
Operating system and version (eg, Ubuntu 20.04): 20.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.48
PHP version (eg, 7.4): 7.4.3

The issue you are facing: The LDAP Remnant list still contains users that have already been deleted

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

Steps to replicate it:

  1. Run

sudo -u www-data php --define apc.enable_cli=1 /var/www/html/nextcloud/occ ldap:show-remnants

  1. Deleted listed users using

sudo -u www-data php /var/www/html/nextcloud/occ user:delete

  1. Run command sudo -u www-data php --define apc.enable_cli=1 /var/www/html/nextcloud/occ ldap:show-remnants

The output of your Nextcloud log in Admin > Logging:

Error	PHP	Error: ZipArchive::getStream(): Invalid or uninitialized Zip object at /var/www/html/nextcloud/lib/private/Archive/ZIP.php#155		2021-08-25T12:15:24+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-25T11:48:33+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-25T10:00:33+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-25T08:14:39+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-24T17:16:50+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-24T15:16:49+0200
Error	PHP	Error: ZipArchive::getStream(): Invalid or uninitialized Zip object at /var/www/html/nextcloud/lib/private/Archive/ZIP.php#155		2021-08-24T14:28:22+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-24T13:16:44+0200
Error	no app in context	InvalidArgumentException: Invalid Federated Cloud ID		2021-08-24T11:18:07+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-24T11:16:39+0200
Error	PHP	Error: Undefined index: urlsrc at /var/www/html/nextcloud/apps/richdocuments/templates/documents.php#6		2021-08-24T09:22:41+0200
Error	PHP	Error: Undefined index: token at /var/www/html/nextcloud/apps/richdocuments/templates/documents.php#5		2021-08-24T09:22:41+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-24T09:16:37+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-23T17:07:36+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-23T15:07:31+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-23T13:05:40+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-23T11:05:34+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-23T09:05:30+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-20T18:17:04+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-20T16:17:03+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-20T14:17:01+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-20T12:16:57+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-20T11:01:01+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-20T09:00:56+0200
Error	PHP	TypeError: Argument 3 passed to OCA\UserStatus\Controller\UserStatusController::__construct() must be of the type string, null given at /var/www/html/nextcloud/apps/user_status/lib/Controller/UserStatusController.php#62		2021-08-19T22:20:02+0200
Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: 		2021-08-19T14:38:50+0200

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

<?php
$CONFIG = array (
  'instanceid' => '<removed>',
  'passwordsalt' => '<removed>',
  'secret' => '<removed>',
  'trusted_domains' => 
  array (
	<removed>
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'overwrite.cli.url' => '<removed>',
  'dbtype' => 'mysql',
  'version' => '21.0.3.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '<removed>',
  'dbpassword' => '<removed>',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'ldapUserCleanupInterval' => 10,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 3,
  'default_language' => 'de',
  'memcache.distributed' => '\\OC\\Memcache\\APCu',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'mail_from_address' => 'noreply',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => '<removed>',
  'mail_smtphost' => '<removed>',
  'updater.release.channel' => 'stable',
  'trashbin_retention_obligation' => '30, 35',
);

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

[Wed Aug 25 11:46:43.679407 2021] [php7:error] [pid 234841] [client 10.111.63.128:38582] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:46:47.948742 2021] [php7:error] [pid 234837] [client 10.111.63.128:38588] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:46:47.980029 2021] [php7:error] [pid 234828] [client 10.60.40.157:49550] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:46:48.455431 2021] [php7:error] [pid 234838] [client 185.17.204.223:62242] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on li>
[Wed Aug 25 11:46:48.686478 2021] [php7:error] [pid 234794] [client 172.25.48.178:60972] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:46:48.986796 2021] [php7:error] [pid 234844] [client 37.4.228.6:14240] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line 34
[Wed Aug 25 11:46:50.436396 2021] [php7:error] [pid 234778] [client 10.111.65.26:46632] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:46:51.135756 2021] [php7:error] [pid 234836] [client 188.192.228.97:51090] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on li>
[Wed Aug 25 11:46:55.205950 2021] [php7:error] [pid 234849] [client 172.25.49.17:51830] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:46:55.603410 2021] [php7:error] [pid 234828] [client 172.25.48.175:53325] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:46:55.609299 2021] [php7:error] [pid 234837] [client 10.60.40.3:21132] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line 34
[Wed Aug 25 11:46:57.324648 2021] [php7:error] [pid 234838] [client 10.60.40.121:50162] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:00.900980 2021] [php7:error] [pid 234844] [client 10.111.56.66:64712] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:01.031711 2021] [php7:error] [pid 234794] [client 10.60.40.140:51248] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /var/www/html/nextcloud/remote.php:53\nStack trace:\n#0 /var/www/html/n>
[Wed Aug 25 11:47:01.833322 2021] [php7:error] [pid 234778] [client 10.60.40.73:56261] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line >
[Wed Aug 25 11:47:02.477621 2021] [php7:error] [pid 234845] [client 172.25.49.143:60602] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /var/www/html/nextcloud/remote.php:53\nStack trace:\n#0 /var/www/html/>
[Wed Aug 25 11:47:03.362091 2021] [php7:error] [pid 234836] [client 10.60.41.16:49907] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /var/www/html/nextcloud/remote.php:53\nStack trace:\n#0 /var/www/html/ne>
[Wed Aug 25 11:47:03.901968 2021] [php7:error] [pid 234849] [client 188.192.228.97:51226] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on li>
[Wed Aug 25 11:47:05.504953 2021] [php7:error] [pid 234841] [client 185.251.178.250:10500] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on l>
[Wed Aug 25 11:47:05.726961 2021] [php7:error] [pid 234828] [client 188.192.228.97:51242] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on li>
[Wed Aug 25 11:47:11.421433 2021] [php7:error] [pid 234837] [client 10.60.40.204:54962] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:11.699974 2021] [php7:error] [pid 234838] [client 10.60.40.222:59723] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:18.716565 2021] [php7:error] [pid 234844] [client 91.151.24.67:36611] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:19.034672 2021] [php7:error] [pid 234794] [client 10.60.40.245:59104] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:20.746651 2021] [php7:error] [pid 234778] [client 10.60.40.140:60070] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:20.775479 2021] [php7:error] [pid 234849] [client 185.17.204.223:62261] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on li>
[Wed Aug 25 11:47:20.926245 2021] [php7:error] [pid 234845] [client 10.60.40.157:49564] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:21.203847 2021] [php7:error] [pid 234841] [client 37.4.228.6:14281] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line 34
[Wed Aug 25 11:47:22.180193 2021] [php7:error] [pid 234838] [client 10.111.56.106:56583] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:47:22.597994 2021] [php7:error] [pid 234837] [client 10.111.63.120:55982] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:47:22.631282 2021] [php7:error] [pid 234844] [client 10.111.63.26:53968] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:22.912641 2021] [php7:error] [pid 234794] [client 10.111.63.26:53971] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:22.940099 2021] [php7:error] [pid 234849] [client 10.111.63.120:55986] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:47:23.180248 2021] [php7:error] [pid 234845] [client 10.60.40.140:65014] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:26.666362 2021] [php7:error] [pid 234841] [client 10.60.40.172:55118] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:27.366298 2021] [php7:error] [pid 234838] [client 10.60.40.254:55046] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:28.138355 2021] [php7:error] [pid 234837] [client 185.251.178.250:10707] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on l>
[Wed Aug 25 11:47:29.195457 2021] [php7:error] [pid 234778] [client 10.60.40.148:62586] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:30.914935 2021] [php7:error] [pid 234849] [client 10.60.40.140:56546] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /var/www/html/nextcloud/remote.php:53\nStack trace:\n#0 /var/www/html/n>
[Wed Aug 25 11:47:32.406696 2021] [php7:error] [pid 234845] [client 172.25.49.143:60613] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /var/www/html/nextcloud/remote.php:53\nStack trace:\n#0 /var/www/html/>
[Wed Aug 25 11:47:32.900955 2021] [php7:error] [pid 234841] [client 10.111.56.66:56666] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:33.444144 2021] [php7:error] [pid 234838] [client 10.60.41.16:49916] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() on null in /var/www/html/nextcloud/remote.php:53\nStack trace:\n#0 /var/www/html/ne>
[Wed Aug 25 11:47:37.535618 2021] [php7:error] [pid 234837] [client 10.60.40.100:55032] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on line>
[Wed Aug 25 11:47:38.674007 2021] [php7:error] [pid 234844] [client 185.251.178.250:10801] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on l>
[Wed Aug 25 11:47:42.405202 2021] [php7:error] [pid 234794] [client 195.234.12.218:30441] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on li>
[Wed Aug 25 11:47:43.959115 2021] [php7:error] [pid 234778] [client 10.140.15.123:56630] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:47:44.208367 2021] [php7:error] [pid 234849] [client 172.25.49.196:60672] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:47:48.002491 2021] [php7:error] [pid 234841] [client 95.118.42.210:40304] PHP Parse error:  syntax error, unexpected ''maintenance'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/html/nextcloud/config/config.php on lin>
[Wed Aug 25 11:47:51.844279 2021] [access_compat:error] [pid 234794] [client 10.111.63.128:38600] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:47:54.183081 2021] [access_compat:error] [pid 234828] [client 10.60.40.157:49579] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:47:54.574431 2021] [access_compat:error] [pid 234957] [client 185.17.204.223:62288] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:47:55.054240 2021] [access_compat:error] [pid 234948] [client 37.4.228.6:45438] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:47:55.663318 2021] [access_compat:error] [pid 234960] [client 188.192.228.97:51636] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:47:57.106296 2021] [mpm_prefork:notice] [pid 797] AH00170: caught SIGWINCH, shutting down gracefully
[Wed Aug 25 11:47:57.453624 2021] [mpm_prefork:notice] [pid 234996] AH00163: Apache/2.4.48 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Wed Aug 25 11:47:57.453696 2021] [core:notice] [pid 234996] AH00094: Command line: '/usr/sbin/apache2'
[Wed Aug 25 11:48:07.104106 2021] [access_compat:error] [pid 235045] [client 10.111.56.66:60616] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:48:26.004975 2021] [access_compat:error] [pid 235026] [client 10.111.56.106:56612] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:48:31.643919 2021] [access_compat:error] [pid 234997] [client 10.60.40.254:65430] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 11:48:47.788132 2021] [access_compat:error] [pid 235097] [client 172.25.49.196:59790] AH01797: client denied by server configuration: /var/www/html/nextcloud/config
[Wed Aug 25 12:23:39.165733 2021] [access_compat:error] [pid 236668] [client 10.60.40.141:63899] AH01797: client denied by server configuration: /var/www/html/nextcloud/config