Fading Coder

An Old Coder’s Final Dance

You are here: Home > Tech > Content

Fixing pycurl.so “undefined symbol: CRYPTO_num_locks” Breaking yum on RHEL/CentOS

Tech 5

This error typical indicates that pycurl is loading a libcurl linked against an incompatible OpenSSL version. The dynamic linker is likely picking up the wrong libcurl (often from a leftover custom install, such as a MySQL bundle), instead of the system one.

Symptom

Running yum (or any Python that imports pycurl) fails with:

/usr/lib64/python2.7/site-packages/pycurl.so: undefined symbol: CRYPTO_num_locks

Diagnose the mislinked library

  1. Inspect which shared libraries pycurl resolves at runtime:
ldd /usr/lib64/python2.7/site-packages/pycurl.so
  • Look specifically at the path for libcurl.so. If it points to something under /usr/local, a vendor-specific directory, or a non-standard path, that’s a red flag.
  1. See what ldconfig knows about libcurl and where it prefers to load it from:
ldconfig -v | grep -E 'libcurl(\.so)?'

If multiple libcurl entries appear, note their directories. A non-system copy (for example, under /usr/local/lib or a MySQL-installed directory) may be shadowing the system libcurl.

  1. List the cached candidates and their origins:
ldconfig -p | grep -E 'libcurl(\.so)?'

This confirms which libcurl paths are registered in the dynamic linker cache.

Correct the linker search paths

  1. Review custom linker paths that might prioritize a non-system libcurl. Check the main config and drop-ins:
grep -H . /etc/ld.so.conf /etc/ld.so.conf.d/*.conf

If you see entries adding directories for a custom stack (e.g., a MySQL-provided lib directory), consider removing or commenting them out. For example:

vi /etc/ld.so.conf
  • Remove or comment any line that injects a “local lib” ahead of system libs (such as /usr/local/lib or a vendor-specific lib directory) if it contains an incompatible libcurl.
  1. If a stray library directory was installed by a package you’ve already removed (e.g., a MySQL bundle that dropped its own libcurl), delete or rename that directory so it can’t be picked up:
# Example: adjust to the actual path you identified
mv /usr/local/mysql/lib /usr/local/mysql/lib.bak
  1. Rebuild the dynamic linker cache:
ldconfig
  1. Verify the cache and linkage again:
ldconfig -p | grep curl
ldd /usr/lib64/python2.7/site-packages/pycurl.so
  • Ensure libcurl now resolves to the system path (typically under /usr/lib64 or /usr/lib on RHEL/CentOS).

Test yum

Once libcurl resolves to the correct system library, retry yum:

yum search pycurl

If the commmand runs without the CRYPTO_num_locks error, the mislinked libcurl has been removed from the search path and the issue is resolved.

Tags: pycurl

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.