Troubleshooting "incompatible user IDs have been found" error

This article helps debug the "ValueError: Invalid username:" error involving LDAP users during upgrades.

LAST TESTED ON CHECKMK 2.2.0P1

Table of Contents


This issue has been resolved in https://checkmk.com/werk/15815


This issue has been noticed while upgrading from 2.1 to 2.2.

Problem

While upgrading from 2.1 to 2.2,  an error referencing "Invalid username" or something related to Ldap and sync_time may occur.

-| Updating Checkmk configuration...
-| 01/20 Validate user IDs...
-| ERROR: Update aborted.

-| Incompatible user IDs have been found. Updating is not possible. See Werk #15182
-| for further information. There are no invalid users in contacts.mk and users.mk.

-| Check 'etc/htpasswd', 'etc/auth.serials', and the directory names in
-| 'var/check_mk/web'.
-| + "Validate user IDs" failed
-| Traceback (most recent call last):
-| File "/omd/sites/mysite/lib/python3/cmk/update_config/main.py", line 223, in _call_
-| action(self._logger, self.update_state.setdefault(action.name))
-| File "/omd/sites/mysite/lib/python3/cmk/update_config/plugins/actions/validate_user_ids.py", line 28, in _call_
-| load_users()
-| File "/omd/sites/mysite/lib/python3/cmk/gui/userdb/store.py", line 217, in load_users
-| uid = UserId(user_dir)
-| ^^^^^^^^^^^^^^^^
-| File "/omd/sites/mysite/lib/python3/cmk/utils/type_defs/user_id.py", line 145, in _new_
-| cls.validate(text)
-| File "/omd/sites/mysite/lib/python3/cmk/utils/type_defs/user_id.py", line 125, in validate
-| raise ValueError(f"Invalid username: {text!r}")
-| ValueError: Invalid username: 'my_ldap_user (T0)_sync_time.mk'
-| ERROR: Please repair this and run "cmk-update-config" BEFORE starting the site again.
-| Traceback (most recent call last):
-| File "/omd/sites/mysite/lib/python3/cmk/update_config/main.py", line 90, in main
-| return ConfigUpdater(logger, update_state)()
-| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-| File "/omd/sites/mysite/lib/python3/cmk/update_config/main.py", line 223, in _call_
-| action(self._logger, self.update_state.setdefault(action.name))
-| File "/omd/sites/mysite/lib/python3/cmk/update_config/plugins/actions/validate_user_ids.py", line 28, in _call_
-| load_users()
-| File "/omd/sites/mysite/lib/python3/cmk/gui/userdb/store.py", line 217, in load_users
-| uid = UserId(user_dir)
-| ^^^^^^^^^^^^^^^^
-| File "/omd/sites/mysite/lib/python3/cmk/utils/type_defs/user_id.py", line 145, in _new_
-| cls.validate(text)
-| File "/omd/sites/mysite/lib/python3/cmk/utils/type_defs/user_id.py", line 125, in validate
-| raise ValueError(f"Invalid username: {text!r}

-| ValueError: Invalid username: 'my_ldap_user (T0)_sync_time.mk' 
-| ERROR: Please repair this and run "cmk-update-config" BEFORE starting the site again.


Solution


  1. While logged in as the site user, run a find command to search for that particular user

    OMD[mysite]~# find . -name "my_ldap_user (T0)_sync_time.mk"
    
    ./var/check_mk/web/my_ldap_user (T0)_sync_time.mk

    .
    This command found a filename related to that user within ~/var/check_mk/web/
    .

  2. Move that file outside of your site folder

    OMD[mysite]~# mv ~/var/check_mk/web/my_ldap_user (T0)_sync_time.mk /home/mylinuxuser/

    In the above example, the file was moved to the home directory of a basic Linux user
    .

  3. Verify the configuration

    OMD[mysite]~# cmk-update-config -vv