ruby-oci8 & SELinux

LoadError: /opt/oracle/instantclient_10_2/libnnz10.so: cannot restore segment prot after reloc: Permission denied - /usr/local/ruby192p0/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.3/lib/oci8lib_191.so
from :29:in require'
from :29:in
require'
from /usr/local/ruby192p0/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.3/lib/oci8.rb:23:in '
from :33:in
require'
from :33:in rescue in require'
from :29:in
require'
from (irb):1
from /usr/local/ruby/bin/irb:12:in `'

/libnnz10.so: cannot restore segment prot after

If you encounter an error like above, the problem very well could be the SELinux (Security Enhanced Linux) conf setting.   We ran into this issue trying to use ruby-oci8 in our rails application.  It was working on one CentOS VM we built, but not on another coworkers.  After painstakingly taking things apart, it turns out the difference between the two virtual machine instances was that the ‘getenforce’ command returned ‘Disabled’ on one and ‘Enforcing’ on another.

A quick ‘setenforce 0’ will enable you to test out if this fixes your issue.  However be warned that to disable it so that it doesn’t come back after restarting, you must modify the ‘/etc/selinux/config’ to disable it permanently.   GL!