-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.DirectoryServices.Protocols.LdapConnection fails to find the new version of the LDAP library on Ubuntu 22.04 #69456
Comments
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 Issue DetailsDescriptionUbuntu 20.04 has LDAP library libldap-2.4 https://packages.ubuntu.com/source/focal/openldap When running .NET Core 6 code on Ubuntu 22.04, System.DirectoryServices.Protocols.LdapConnection cannot find the latest version of LDAP an fails. Reproduction StepsInstall the LDAP libraries on Ubuntu 22.04:
Steps to reproduce:
Expected behaviorSystem.DirectoryServices.Protocols.LdapConnection finds the 2.5.11 version of LDAP library on Ubuntu 22.04 and connects to the LDAP server. Actual behavior
Regression?Same code worked under Ubuntu 20.04, which has libldap-2.4, the library System.DirectoryServices.Protocols.LdapConnection is looking for. Known WorkaroundsOn Ubuntu 22.04, create a symbolic link from ldap-2.4 to ldap-2.5:
Configuration
Other informationNo response
|
We hard code this version
If I'm looking at the right thing, 2.5 came out a year ago, and current is 2.6. |
Correct, we hard coded the version because back when we added the support the library hadn't been updated in over 14 years so we didn't expect exact versioning to be a problem, but it does seem like two new versions have been released since then. By taking a quick look at the changelog it doesn't seem like we should have any issues with also supporting 2.5 and 2.6, but we will need to test all of our scenarios in order to double check, and then we can adjust that line to be able to support those other versions as well. |
I got the same problem on Kubuntu 22.04, here's my environment just in case (seems to be the same as OP's):
I have a .NET 6 project that uses While suggested workaround with adding a symlink does work, one might prefer to actually download the version 2.4 from archive and install it:
For me that also resolved the problem, so that might be an alternative workaround. |
I took a look at this today. Unfortunately, seems like libldap doesn't provide a major version |
I chatted with @AaronRobinsonMSFT about this last week. There is a way for us to basically hook into an event that gets triggered whenever binding to the native assembly fails, and at that point we can try some other versions to see if we can find one supported which is installed, and that seemed like a good-enough solution for now. Unfortunately, we won't have enough bandwidth to get that done for 7.0 any longer, so I'm adjusting the milestone accordingly. For folks hitting this in 7.0, They will be able to use the workarounds provided above (adding symlink or manually downloading the 2.4 version) in order to get unblocked. I tried both and they worked for me in Ubuntu 22.04. |
I still have this problem. Can someone explain me where is my mistake? `try
|
This is expected. The reason why this happens has nothing to do with your code, but instead with the native library installed in ubuntu 22.04. There is no fix for this available yet, just a known workaround that was posted above. Copying it here for reference:
After running that, you should be able to run your app (this is assuming you are running on a x64 machine) |
I already did. Should I reboot the machine or something like that? Just for reference:
|
Does this workaround work with alpine based images? |
After some quick testing. Looks like this workaround does work for .net 6 alpine based images. Might need to update the link if the libldap version changes. Here is my docker file
Looks like this is what you want in you /usr/lib directory.
My C# for ref.
|
…ctoryServices in linux: dotnet/runtime#69456 - Reverted back System.DirectoryServices.Protocols back to version 6.0.1
@jade-lucas workaround worked here in 7.0-alpine |
works also for 7.0-jammy |
8.0-preview5 apline I had to add in the runtime identifier to be linux-musl-x64. |
An alternative work around that worked for me is to use AssemblyLoadContext as shown below:
|
Description
Ubuntu 20.04 has LDAP library libldap-2.4 https://packages.ubuntu.com/source/focal/openldap
Ubuntu 22.04 has LDAP library libldap-2.5.11 https://packages.ubuntu.com/source/jammy/openldap
When running .NET Core 6 code on Ubuntu 22.04, System.DirectoryServices.Protocols.LdapConnection cannot find the latest version of LDAP an fails.
Reproduction Steps
Install the LDAP libraries on Ubuntu 22.04:
Steps to reproduce:
Run the following code from an ASP.NET Core 6 application on Ubuntu 22.04:
Expected behavior
System.DirectoryServices.Protocols.LdapConnection finds the 2.5.11 version of LDAP library on Ubuntu 22.04 and connects to the LDAP server.
Actual behavior
Regression?
Same code worked under Ubuntu 20.04, which has libldap-2.4, the library System.DirectoryServices.Protocols.LdapConnection is looking for.
Known Workarounds
On Ubuntu 22.04, create a symbolic link from ldap-2.4 to ldap-2.5:
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: