MATLAB Answers

0

Why do I receive errors relating to the file "libmwlapack" when starting MATLAB 7.0.1 (R14SP3) or higher on Linux?

When starting MATLAB on a Red Hat or Fedora machine, I get the error message:
/usr/local/matlab/bin/glnx86/libmwlapack.so:
cannot restore segment prot after reloc: Permission denied
MATLAB fails to load at this point.

Tags

No tags entered yet.

Products


Release

R2006a

1 Answer

Answer by MathWorks Support Team on 4 Jan 2019
 Accepted Answer

This error message indicates that SELinux is preventing MATLAB from starting on this machine. This problem occurs with distributions that are based on the Red Hat Linux kernel.
To confirm that SELinux is preventing MATLAB from starting, you can temporarily disable SELinux by running the following command as root:
/usr/sbin/setenforce 0
(/usr/sbin/setenforce 1 will turn SELinux back on)
Once SELinux is turned off, try MATLAB again. If MATLAB starts, you should be able to start MATLAB by adjusting your SELinux settings. There are a few ways to do so:
1. Add MATLAB to the texrel_shlib_t context and turn on the allow_execheap boolean
In order to run MATLAB with SELinux, you will need to turn on the allow_execheap boolean. This boolean affects all applications on the system and changes the access protection of memory on the heap. To turn on allow_execheap, you can run the following command as root:
setsebool -P allow_execheap=1
Additionally, you will need to add the MATLAB libraries to the to the texrel_shlib_t context. To do so you can run the following:
chcon -t texrel_shlib_t $MATLABROOT/bin/$ARCH/*.so*
chcon -t texrel_shlib_t $MATLABROOT/sys/java/jre/$ARCH/$JRE/lib/{i386|amd64}/*.so
chcon -t texrel_shlib_t $MATLABROOT/sys/webrenderer/linux/*.so
where $MATLABROOT is your MATLAB installation folder, $ARCH is the architecture of the machine (glnx86 for 32 bit Linux, glnxa64 for 64 bit Linux) and $JRE is the JRE folder for your MATLAB version (generally "jre1.6.0"). If you have 32 bit MATLAB, you will use the i386 option. For 64 bit, use amd64. Refer to your installation folder for the paths specific to your MATLAB version.
For example, if you are using MATLAB 7.7 (R2008b) on 32 bit Linux, the commands would be:
chcon -t texrel_shlib_t /usr/local/matlab/bin/glnx86/*.so
chcon -t texrel_shlib_t /usr/local/matlab/sys/java/jre/glnx86/jre1.6.0/lib/i386/*.so
Once complete, this should give MATLAB the sufficient permissions to run with SELinux. If you continue to get an error, you may need to add any subsequent libraries to the texrel_shlib_t context. For more assistance you can run:
sealert -b
to bring up the setroubleshoot browser. This browser will show all the exceptions and provide advice to bypass the denial.
If you do not have a Linux GUI environment, you can also check /var/log/messages for error messages or /var/log/setroubleshoot. For more assistance, run:
man sealert
man setroubleshoot
2. Set SELinux to permissive mode:
If you are unfamiliar with SELinux, or the options above do not allow MATLAB to start, you can change SELinux to permissive mode. In permissive mode, SELinux will continue to log error messages, but it will not block any processes from running. To change SELinux to permissive, change the appropriate line in /etc/sysconfig/selinux from "selinux=enforcing" to "selinux=permissive".
Once complete, restart the machine to enable the changes.
3. Turn off SELinux:
Finally, if none of the options above allow you to start MATLAB, or if you do not want to run SELinux, you can disable it completely. To do so, change the appropriate line in /etc/sysconfig/selinux from "selinux=enforcing" or "selinux=permissive" to "selinux=disabled".
After rebooting, SELinux will no longer log or deny any processes.
For more information about SELinux, see the information below:
FAQ about SELinux
Affected Distributions

  0 Comments

Sign in to comment.