Easysoft Data Access

Why do I get error "cannot restore segment prot after reloc: Permission denied"?

Article:
00976
Last Reviewed:
4th January 2024
Revision:
1

If your Linux distribution has Security-enhanced Linux (SELinux) enabled, you may get error "cannot restore segment prot after reloc: Permission denied" when using an Easysoft ODBC driver. This error occurs because the Easysoft ODBC driver libraries require text relocation, but the SELinux policy on your machine prevents this. To work around this, change the SELinux policy to allow the use of libraries that require text relocation. To do this, as root, run:

chcon -t texrel_shlib_t

This example output uses the Easysoft ODBC-SQL Server Driver to illustrate the error and the workaround:

# isql -v mydsn
[01000][unixODBC][Driver Manager]Can't open lib 
'/usr/local/easysoft/sqlserver/lib/libessqlsrv.so' : 
/usr/local/easysoft/sqlserver/lib/libessqlsrv.so: cannot restore segment 
prot after reloc: Permission denied
[ISQL]ERROR: Could not SQLConnect
# dltest /usr/local/easysoft/sqlserver/lib/libessqlsrv.so
[dltest] ERROR dlopen: /usr/local/easysoft/sqlserver/lib/libessqlsrv.so: 
cannot restore segment prot after reloc: Permission denied
# chcon -t texrel_shlib_t 
/usr/local/easysoft/sqlserver/lib/libessqlsrv.so
# dltest /usr/local/easysoft/sqlserver/lib/libessqlsrv.so
SUCCESS: Loaded /usr/local/easysoft/sqlserver/lib/libessqlsrv.so
Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)