sqlplus: error while loading shared libraries
September 26, 2011 1 Comment
Error Description: sqlplus: error while loading shared libraries: $ORACLE_HOME/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied
One of the way to solve this error is to disable SELinux(as some people advice on the forums). But it is related to the security risks.
So I decided to use Linux provided solution, which is safer:
–After I ran the following command:
# sqlplus / as sysdba
There appeard our error and some tip on the screen, indicating the solution of this error, I want to share it with you.
The brief summery is to run the following command:
$ chcon -t textrel_shlib_t '/u0/app/oracle/product/11.2.0/db_1/lib/libcntsh.so.11.1'
Note: My $ORACLE_HOME=/u0/app/oracle/product/11.2.0/db_1
The whole text in the message from Linux is the following , I think it is very interesting:
Summary SELinux is preventing sqlplus from loading /u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1 which requires text relocation. Detailed Description The sqlplus application attempted to load /u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1 which requires text relocation. This is a potential security problem. Most libraries do not need this permission. Libraries are sometimes coded incorrectly and request this permission. The SELinux Memory Protection Tests web page explains how to remove this requirement. You can configure SELinux temporarily to allow /u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1 to use relocation as a workaround, until the library is fixed. Please file a bug report against this package. Allowing Access If you trust /u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1 to run correctly, you can change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t '/u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1'" You must also change the default file context files on the system in order to preserve them even on a full relabel. "semanage fcontext -a -t textrel_shlib_t '/u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1'" The following command will allow this access: chcon -t textrel_shlib_t '/u0/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1' ...
Awesome man.. u rock 😉