LDAP broken after attempting upgrade to 3.5.x [SOLVED]

When things don't work as they should.
Post Reply
Posts: 11
Joined: Mon Dec 30, 2019 10:56 pm

LDAP broken after attempting upgrade to 3.5.x [SOLVED]

Post by sna-cmarko »

I had LDAP working in versions 3.4.x, but after trying to upgrade to 3.5.x (I have tried 3.5.1 and 3.5.4) I continue to get:

Code: Select all

 creating build/temp.linux-x86_64-3.7/Modules
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=3.3.1 -DLDAPMODULE_AUTHOR=python-ldap project -DLDAPMODULE_LICENSE=Python style -IModules -I/opt/mayan-edms/include -I/usr/include/python3.7m -c Modules/LDAPObject.c -o build/temp.linux-x86_64-3.7/Modules/LDAPObject.o
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Command "/opt/mayan-edms/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-0retrko5/python-ldap/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-g9om4379/install-record.txt --single-version-externally-managed --compile --install-headers /opt/mayan-edms/include/site/python3.7/python-ldap" failed with error code 1 in /tmp/pip-install-0retrko5/python-ldap/
mayan: performupgrade()
Traceback (most recent call last):
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/core/management/__init__.py", line 204, in fetch_command
    app_name = commands[subcommand]
KeyError: 'performupgrade'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/mayan-edms/bin/mayan-edms.py", line 10, in <module>
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/core/management/__init__.py", line 211, in fetch_command
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/opt/mayan-edms/lib/python3.7/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/var/lib/mayan/mayan_settings/myldapfile.py", line 12, in <module>
    import ldap
ModuleNotFoundError: No module named 'ldap'
I'm running Mayan in Docker on Ubuntu 20. I didn't find anything in the release notes that indicated to me it wouldn't work. Nothing has changed on my Ubuntu box since I upgraded to 3.4.17.

Anyone else run into this issue?
Caitlyn Marko
Sine Nomine Associates
Posts: 2
Joined: Mon Jan 04, 2021 7:53 pm

Re: LDAP broken after attempting upgrade to 3.5.x

Post by jnyoke »

I too have this issue and have been trying to set this up from scratch using the docker-compose method. Everything works until I activate my module (it is named myldapfile so it does not have the ldap name conflict. I get the "No module named ldap"

Peering through the logs initially I saw that it could not build python-ldap due to effectively missing gcc. This is on the module install list however. I removed all of the APT installs except gcc", then a missing .h file stopped the build. I trouble shot it all the way down to libldap2-dev, but this too is having an error and presumably stops the rest from installing:

app_1 | The following packages have unmet dependencies:
app_1 | libldap2-dev : Depends: libldap-2.4-2 (= 2.4.47+dfsg-3+deb10u4) but 2.4.56+dfsg-1~bpo10+1 is to be installed
app_1 | W: --force-yes is deprecated, use one of the options starting with --allow instead.
app_1 | E: Unable to correct problems, you have held broken packages.

I am far from a docker guru, so I am a bit stuck.
Posts: 2
Joined: Mon Jan 04, 2021 7:53 pm

Re: LDAP broken after attempting upgrade to 3.5.x

Post by jnyoke »

This is where I have got...any assistance is greatly appreciated.
By first disabling my settings module, then issuing manual commands:
docker-compose -p mayan exec app apt-get update <- I had to do this or the package was not available...
docker-compose -p mayan exec app apt install libldap-2.4-2=2.4.47+dfsg-3+deb10u4 <- force the older package

libldap-2.4-2 is already installed on the image and it seems libre office and some other things depend on it. Downgrading did not seem to cause issue to these packages.

I could then install the rest of the packages and the python modules. Presumably it would then work. My issue however is that I don't know how to tell Mayan to use my LDAP settings (via the settings module).

I am also unable to implement any of the above with my settings file on in the docker-compose as it seems the machine will continually reboot.
I also wonder if just doing a package update may also fix this as it looks like a stale or old packages maybe being used with a newer version of libldap-2.4-2

Using the above method also does not survive a docker reboot - I am still learning this technology.

If I were using the manual install method I think that I could get around this...I may in fact do this, or just find a different path.

I really need to have LDAP or this is just not workable in my environment.
Posts: 1
Joined: Sat Jan 30, 2021 11:48 pm

Re: LDAP broken after attempting upgrade to 3.5.x

Post by mattange »


i am seeing the same exact error. When trying to follow the guide on LDAP integration on this forum, the version 3.5.5 of the Docker image appears not to be able to install and then compile python-ldap due to conflicts in the version of the libldap-2.4-2 library.
Once the requirement to DOWNGRADE the package is added to the list of the installs, the installation proceeds normally.
Once i get LDAP working (i am using Active Directory) i shall post here the solution for that.

However, the original docker image does need fixing i believe. I tried forking the repo and rebuilding it myself but that seems to generate other errors... perhaps i am just not used to that workflow and i am not doing the right things to build it.

Kind regards

User avatar
Posts: 651
Joined: Tue Aug 21, 2018 3:28 am
Location: Puerto Rico

Re: LDAP broken after attempting upgrade to 3.5.x

Post by rosarior »

The sample LDAP setting file was updated with two solutions: https://gitlab.com/mayan-edms/mayan-edms/-/issues/963

Either specify the exact libldap-2.4-2 version using "libldap-2.4-2=2.4.47+dfsg-3+deb10u4" or specify to use the libldap2-dev from the backports using "libldap2-dev/buster-backports"
Post Reply