Login with Azure button stopped working

CMK version: 2.5.0p13
OS version: 24.04.1-Ubuntu

Error message: ImportError: libldap_r-2.4.so.2: cannot open shared object file: No such file or directory

A couple of weeks ago my Login with Azure button stopped working. Instead of being able to login, it would redirect me back to the login page. I have CheckMK Ultimate running in an EC2 instance that I access via a Checkpoint SASE system, which had all been working for some months until recently. If I use one of the local accounts my logins work fine.
I have tried checking the settings on the Azure side and everything seems up to date. Running through the whole process to provide LDAP logins from scratch leads me to the same point.

Using DevTools in the browser suggested no errors were being sent, only redirects.

Having not looked into the Apache logs I can see there are some possibly related errors:

[Mon Sep 14 15:26:58.169230 2026] [mpm_prefork:notice] [pid 1398] AH00163: Apache/2.4.52 (Ubuntu) mod_wsgi/4.9.4 Python/3.12 mod_fcgid/2.3.9 configured -- resuming normal operations
[Mon Sep 14 15:26:58.170449 2026] [core:notice] [pid 1398] AH00094: Command line: '/usr/sbin/apache2 -f /omd/sites/installations/etc/apache/apache.conf'
[Mon Sep 14 15:27:06.381264 2026] [wsgi:error] [pid 1402] mod_wsgi (pid=1402): Failed to exec Python script file '/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/index.wsgi'.
[Mon Sep 14 15:27:06.381324 2026] [wsgi:error] [pid 1402] mod_wsgi (pid=1402): Exception occurred processing WSGI script '/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/index.wsgi'.
[Mon Sep 14 15:27:06.389949 2026] [wsgi:error] [pid 1402] Traceback (most recent call last):
[Mon Sep 14 15:27:06.390397 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/index.wsgi", line 50, in <module>
[Mon Sep 14 15:27:06.390410 2026] [wsgi:error] [pid 1402]     Application = LazyImportProfilingMiddleware(
[Mon Sep 14 15:27:06.390414 2026] [wsgi:error] [pid 1402]                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon Sep 14 15:27:06.390427 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/utils/profile_switcher.py", line 266, in __init__
[Mon Sep 14 15:27:06.390431 2026] [wsgi:error] [pid 1402]     super().__init__(config_loader=config_loader)
[Mon Sep 14 15:27:06.390441 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/utils/profile_switcher.py", line 116, in __init__
[Mon Sep 14 15:27:06.390446 2026] [wsgi:error] [pid 1402]     self._profile_setting: ProfileSetting = config_loader()
[Mon Sep 14 15:27:06.390450 2026] [wsgi:error] [pid 1402]                                             ^^^^^^^^^^^^^^^
[Mon Sep 14 15:27:06.390458 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/utils/profile_switcher.py", line 86, in __call__
[Mon Sep 14 15:27:06.390463 2026] [wsgi:error] [pid 1402]     return self.fetch_default_config()
[Mon Sep 14 15:27:06.390466 2026] [wsgi:error] [pid 1402]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon Sep 14 15:27:06.390475 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/index.wsgi", line 34, in load_actual_config
[Mon Sep 14 15:27:06.390479 2026] [wsgi:error] [pid 1402]     from cmk.gui.wsgi.applications import utils
[Mon Sep 14 15:27:06.390487 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/__init__.py", line 6, in <module>
[Mon Sep 14 15:27:06.390492 2026] [wsgi:error] [pid 1402]     from cmk.gui.wsgi.applications.checkmk import CheckmkApp
[Mon Sep 14 15:27:06.390509 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/checkmk.py", line 41, in <module>
[Mon Sep 14 15:27:06.390512 2026] [wsgi:error] [pid 1402]     from cmk.gui.wsgi.applications.utils import (
[Mon Sep 14 15:27:06.390531 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/wsgi/applications/utils.py", line 19, in <module>
[Mon Sep 14 15:27:06.390534 2026] [wsgi:error] [pid 1402]     import cmk.gui.auth
[Mon Sep 14 15:27:06.390540 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/auth.py", line 27, in <module>
[Mon Sep 14 15:27:06.390543 2026] [wsgi:error] [pid 1402]     from cmk.gui import userdb
[Mon Sep 14 15:27:06.390550 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/userdb/__init__.py", line 9, in <module>
[Mon Sep 14 15:27:06.390553 2026] [wsgi:error] [pid 1402]     from ._check_credentials import check_credentials as check_credentials
[Mon Sep 14 15:27:06.390560 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/userdb/_check_credentials.py", line 27, in <module>
[Mon Sep 14 15:27:06.390563 2026] [wsgi:error] [pid 1402]     from .ldap_connector import MKLDAPException
[Mon Sep 14 15:27:06.390571 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3/cmk/gui/userdb/ldap_connector.py", line 42, in <module>
[Mon Sep 14 15:27:06.390574 2026] [wsgi:error] [pid 1402]     import ldap  # type: ignore[import]
[Mon Sep 14 15:27:06.390577 2026] [wsgi:error] [pid 1402]     ^^^^^^^^^^^
[Mon Sep 14 15:27:06.390583 2026] [wsgi:error] [pid 1402]   File "/omd/sites/installations/lib/python3.12/site-packages/ldap/__init__.py", line 34, in <module>
[Mon Sep 14 15:27:06.390586 2026] [wsgi:error] [pid 1402]     import _ldap
[Mon Sep 14 15:27:06.390606 2026] [wsgi:error] [pid 1402] ImportError: libldap_r-2.4.so.2: cannot open shared object file: No such file or directory

Now I cannot say if this is the original problem of a new one of my own making. When the issue first occurred we were still running 2.2.0 on Ubuntu 20.04, so my first step after checking all the settings was to complete a few updates.
Is there some part of the site’s Python environment I need to update or a missing package somewhere?