Groups synced from LDAP are now empty after upgrading from NC18 to NC22

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 22.2.6
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.29
PHP version (eg, 7.4): 7.3.33

The issue you are facing:

I’ve been upgrading my NextCloud server from version 18 all the way up to 22, including upgrading MariaDB to a supported version. With NC18, the server was synchronising correctly with LDAP for users and groups but, after going through all of the upgrades, a lot of the groups are not being populated with members.

There is a “disconnect” between what NextCloud says about the groups a user is in:

$ /usr/bin/php7.3 occ user:info pierrick.bouvier
  - user_id: pierrick.bouvier
  - display_name: Pierrick Bouvier
  - email: REDACTED
  - cloud_id: REDACTED
  - enabled: true
  - groups:
    - team-woa
  - quota: none
  - last_seen: 2022-04-08T07:35:52+00:00
  - user_directory: /srv/nextcloud-data/pierrick.bouvier
  - backend: LDAP

and the membership of a group:

$ /usr/bin/php7.3 occ group:info team-woa
  - groupID: team-woa
  - displayName: team-woa
  - backends:
    - LDAP

I can’t find a way of getting NextCloud to “rescan” the LDAP groups and refresh its group membership information.

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

Steps to replicate it:

  1. Configure system to use LDAP
  2. Upgrade from 18 all the way up to 22
  3. Check group membership

The output of your Nextcloud log in Admin > Logging:

{"reqId":"mwZ17Vwb1zJi8VoRJw5b","level":3,"time":"2022-04-08T07:28:58+00:00","remoteAddr":"83.226.143.29","user":"diana.picus","app":"PHP","method":"GET","url":"/apps/files/?dir=/WoA","message":"disk_free_space(): No such file or directory at /srv/nextcloud-18/lib/private/Files/Storage/Local.php#381","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36","version":"22.2.6.2","exception":{"Exception":"Error","Message":"disk_free_space(): No such file or directory at /srv/nextcloud-18/lib/private/Files/Storage/Local.php#381","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"disk_free_space(): No such file or directory","/srv/nextcloud-18/lib/private/Files/Storage/Local.php",381,{"path":"files","sourcePath":"/srv/nextcloud-data/diana.picus"}]},{"file":"/srv/nextcloud-18/lib/private/Files/Storage/Local.php","line":381,"function":"disk_free_space","args":["/srv/nextcloud-data/diana.picus"]},{"file":"/srv/nextcloud-18/lib/private/Files/Storage/Wrapper/Wrapper.php","line":334,"function":"free_space","class":"OC\\Files\\Storage\\Local","type":"->","args":["files"]},{"file":"/srv/nextcloud-18/lib/private/legacy/OC_Helper.php","line":534,"function":"free_space","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["files"]},{"file":"/srv/nextcloud-18/apps/files/lib/Controller/ViewController.php","line":154,"function":"getStorageInfo","class":"OC_Helper","type":"::","args":["/",{"__class__":"OC\\Files\\FileInfo"}]},{"file":"/srv/nextcloud-18/apps/files/lib/Controller/ViewController.php","line":204,"function":"getStorageInfo","class":"OCA\\Files\\Controller\\ViewController","type":"->","args":[]},{"file":"/srv/nextcloud-18/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"index","class":"OCA\\Files\\Controller\\ViewController","type":"->","args":["/WoA","",null,false,null]},{"file":"/srv/nextcloud-18/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/srv/nextcloud-18/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/srv/nextcloud-18/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files\\Controller\\ViewController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files.view.index"}]},{"file":"/srv/nextcloud-18/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files/"]},{"file":"/srv/nextcloud-18/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/srv/nextcloud-18/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"624fe49cd69f3"}

{"reqId":"XV37oL14KEvRNiKDqrgt","level":3,"time":"2022-04-08T07:22:08+00:00","remoteAddr":"92.11.187.118","user":"philip.colmer","app":"PHP","method":"GET","url":"/settings/admin/serverinfo","message":"Undefined offset: 4 at /srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php#38","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36 Edg/100.0.1185.29","version":"22.2.6.2","exception":{"Exception":"Error","Message":"Undefined offset: 4 at /srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php#38","Code":0,"Trace":[{"file":"/srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php","line":38,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[8,"Undefined offset: 4","/srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php",38,{"byte":7.999999578005372,"count":4}]},{"file":"/srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php","line":142,"function":"FormatMegabytes","args":[7.999999578005372]},{"file":"/srv/nextcloud-18/lib/private/Template/Base.php","line":180,"args":["/srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php"],"function":"include"},{"file":"/srv/nextcloud-18/lib/private/Template/Base.php","line":150,"function":"load","class":"OC\\Template\\Base","type":"->","args":["/srv/nextcloud-18/apps/serverinfo/templates/settings-admin.php",{"0":"And 9 more entries, set log level to debug to see all entries","hostname":"fileserver","osname":"Linux 5.4.0-1071-aws x86_64","memory":{"__class__":"OCA\\ServerInfo\\Resources\\Memory"},"cpu":"Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (2 cores)","diskinfo":[{"__class__":"OCA\\ServerInfo\\Resources\\Disk"},{"__class__":"OCA\\ServerInfo\\Resources\\Disk"},{"__class__":"OCA\\ServerInfo\\Resources\\Disk"}]}]},{"file":"/srv/nextcloud-18/lib/private/legacy/OC_Template.php","line":179,"function":"fetchPage","class":"OC\\Template\\Base","type":"->","args":[{"0":"And 9 more entries, set log level to debug to see all entries","hostname":"fileserver","osname":"Linux 5.4.0-1071-aws x86_64","memory":{"__class__":"OCA\\ServerInfo\\Resources\\Memory"},"cpu":"Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (2 cores)","diskinfo":[{"__class__":"OCA\\ServerInfo\\Resources\\Disk"},{"__class__":"OCA\\ServerInfo\\Resources\\Disk"},{"__class__":"OCA\\ServerInfo\\Resources\\Disk"}]}]},{"file":"/srv/nextcloud-18/lib/public/AppFramework/Http/TemplateResponse.php","line":204,"function":"fetchPage","class":"OC_Template","type":"->","args":[{"0":"And 9 more entries, set log level to debug to see all entries","hostname":"fileserver","osname":"Linux 5.4.0-1071-aws x86_64","memory":{"__class__":"OCA\\ServerInfo\\Resources\\Memory"},"cpu":"Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (2 cores)","diskinfo":[{"__class__":"OCA\\ServerInfo\\Resources\\Disk"},{"__class__":"OCA\\ServerInfo\\Resources\\Disk"},{"__class__":"OCA\\ServerInfo\\Resources\\Disk"}]}]},{"file":"/srv/nextcloud-18/apps/settings/lib/Controller/CommonSettingsTrait.php","line":138,"function":"render","class":"OCP\\AppFramework\\Http\\TemplateResponse","type":"->","args":[]},{"file":"/srv/nextcloud-18/apps/settings/lib/Controller/AdminSettingsController.php","line":82,"function":"formatSettings","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->","args":[[[{"__class__":"OCA\\ServerInfo\\Settings\\AdminSettings"}]]]},{"file":"/srv/nextcloud-18/apps/settings/lib/Controller/CommonSettingsTrait.php","line":148,"function":"getSettings","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->","args":["serverinfo"]},{"file":"/srv/nextcloud-18/apps/settings/lib/Controller/AdminSettingsController.php","line":67,"function":"getIndexResponse","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->","args":["admin","serverinfo"]},{"file":"/srv/nextcloud-18/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"index","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->","args":["serverinfo"]},{"file":"/srv/nextcloud-18/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AdminSettingsController"},"index"]},{"file":"/srv/nextcloud-18/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AdminSettingsController"},"index"]},{"file":"/srv/nextcloud-18/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AdminSettingsController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"section":"serverinfo","_route":"settings.AdminSettings.index"}]},{"file":"/srv/nextcloud-18/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/admin/serverinfo"]},{"file":"/srv/nextcloud-18/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/srv/nextcloud-18/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"624fe32c17230"}

{"reqId":"NQwt7JmcKvcWtb9vKnBz","level":3,"time":"2022-04-07T13:38:06+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Uninitialized string offset: 0 at /srv/nextcloud-18/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php#39","userAgent":"--","version":"22.2.6.2","exception":{"Exception":"Error","Message":"Uninitialized string offset: 0 at /srv/nextcloud-18/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php#39","Code":0,"Trace":[{"file":"/srv/nextcloud-18/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php","line":39,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[8,"Uninitialized string offset: 0","/srv/nextcloud-18/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php",39,{"k":"*** sensitive parameter replaced ***"}]},{"function":"OC\\Core\\Command\\Maintenance\\Mimetype\\{closure}","class":"OC\\Core\\Command\\Maintenance\\Mimetype\\GenerateMimetypeFileBuilder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/nextcloud-18/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php","line":40,"function":"array_filter","args":[["_comment","_comment2","_comment3","_comment4","_comment5","And 102 more entries, set log level to debug to see all entries"],{"__class__":"Closure"}]},{"file":"/srv/nextcloud-18/apps/onlyoffice/lib/Migration/MimeRepair.php","line":110,"function":"generateFile","class":"OC\\Core\\Command\\Maintenance\\Mimetype\\GenerateMimetypeFileBuilder","type":"->","args":[{"0":"And 102 more entries, set log level to debug to see all entries","_comment":"Array of mimetype aliases.","_comment2":"Any changes you make here will be overwritten on an update of Nextcloud.","_comment3":"Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud","_comment4":"After any change to mimetypealiases.json run:","_comment5":"./occ maintenance:mimetype:update-js"}]},{"file":"/srv/nextcloud-18/lib/private/Repair.php","line":124,"function":"run","class":"OCA\\Onlyoffice\\Migration\\MimeRepair","type":"->","args":[{"__class__":"OC\\Repair"}]},{"file":"/srv/nextcloud-18/core/Command/Maintenance/Repair.php","line":125,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/srv/nextcloud-18/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OC\\Core\\Command\\Maintenance\\Repair","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/nextcloud-18/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/nextcloud-18/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"__class__":"OC\\Core\\Command\\Maintenance\\Repair"},{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/nextcloud-18/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/nextcloud-18/lib/private/Console/Application.php","line":209,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"__class__":"Symfony\\Component\\Console\\Input\\ArgvInput"},{"__class__":"Symfony\\Component\\Console\\Output\\ConsoleOutput"}]},{"file":"/srv/nextcloud-18/console.php","line":99,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/srv/nextcloud-18/occ","line":11,"args":["/srv/nextcloud-18/console.php"],"function":"require_once"}],"File":"/srv/nextcloud-18/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"624fe49cd7686"}

^^^ Note that this is a very small selection from the log. I’ve focussed on the most recent ones. I’m seeing quite a few errors from disc_free_space() but they seem to be all No such file or directory rather than an actual issue around free disc space.

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

<?php
$CONFIG = array (
  'instanceid' => 'ocolokkavppu',
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' =>
  array (
    0 => 'fileserver.linaro.org',
    1 => 'fileserver-ec2.linaro.org',
  ),
  'datadirectory' => '/srv/nextcloud-data',
  'overwrite.cli.url' => 'https://fileserver.linaro.org/',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'mysql',
  'version' => '22.2.6.2',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'REDACTED',
  'dbpassword' => 'REDACTED',
  'logtimezone' => 'UTC',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => '127.0.0.1',
  'mail_from_address' => 'fileserver-dont-reply',
  'mail_domain' => 'linaro.org',
  'loglevel' => 3,
  'lost_password_link' => '',
  'mail_smtpport' => '25',
  'theme' => '',
  'maintenance' => false,
  'updatechecker' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'mysql.utf8mb4' => true,
  'skeletondirectory' => '',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'data-fingerprint' => 'REDACTED',
  'updater.secret' => 'REDACTED',
);

The Apache log is very “busy” with various activities going on. Happy to provide snippets if any are required, rather than the whole log.