Fixing Python error “object from LD_PRELOAD cannot be preloaded”

Background

Using Trac on the Bitnami stack on a AWS server, I needed email notifications. To get email going, I installed sendmail.

In Trac, sendmail would work but there was always an annoying and unsettling warning-error. Warnings, especially ones that have the word error in them, make me nervous.

"Warning: The change has been saved, but an error occurred while sending notifications: Sendmail failed with (0, ERROR: ld.so: object 'libssl.so' from LD_PRELOAD cannot be preloaded: ignored.), command: '[u'sendmail', '-i', '-f', u'no-reply@techborder.com',u'notmyemail@techborder.com']"

Solution

  1. Edit script setenv.sh
    sudo vi /opt/bitnami/scripts/setenv.sh
  2. Comment out the line
    export LD_PRELOAD=libssl.so
  3. Save the file.
  4. Restart Apache
    1. For  Ubuntu
      sudo service apache2 restart
    2. Specific for bitnami
      sudo /opt/bitnami/ctlscript.sh restart apache

Lessons Learned

  1. Try easier way by looking (grep) for hardcoded references to the ‘.so’ file in question.
    I spent a lot of time trying to fix library paths, manually link to new libraries or replace any reference the bitnami python in /opt/bitnami with the system python in /usr. Hours lost which I do not get paid for since this is our company’s own server.
  2. Use bitnami for proof-of-concept only and do not put valuable data or config in the apps.
    At first, bitnami seemed like a good deal with easy setup of tons of web apps, free account for 1 server and automatic backups. But this configuration problem, along with the no easy way to upgrade existing software or add new applications, make bitnami stack, even if free, too expensive compared to a pure AWS server. I’ve never had this much trouble configuration or update trouble with a modern Linux system that uses apt-get.
  3. Python interactive shell is great for troubleshooting.
    Adapting Jim’s script from stackoverflow and running it in the python shell, I was able to trace down the error to a python configuration problem.
    Follow my debug logic. Since I could reproduce the error in python interactive shell, I knew that the error “ld.so: object ‘libssl.so’ from LD_PRELOAD cannot be preloaded: ignored” was probably nothing specific to Trac. Since the system python (/usr/bin) worked fine with sending mail and the bitnami python did not, I knew the error had something to do with the bitnami stack.

Summary

The combination of the completely separate bitnami binaries from the system binaries and various config scripts inconspicuously hidden in various folders in /opt/bitnami/ made this one hard problem to root cause and fix. This took me a way too long to debug. Using my typical Ubuntu or Debian server setup, I probably could have solved this in about 2 hours instead of 8. The Bitnami stack can be a quick way to test drive software, but hand in the keys after the first couple days of driving.