PDA

View Full Version : How do you run matlab without disabling SELinux?



HawkBoy
18th November 2006, 03:26 AM
Hi,

I just installed matlab on a linux machine and running it gives me the following error:

error while loading shared libraries: /usr/local/matlab73/bin/glnx86/libmwlapack.so: cannot restore segment prot after reloc: Permission denied

Disabling SELinux solves the problem, but I don't want to completely disable SELinux. I also have no clue what SELinux is. Does anyone know how to make things work?

Iron_Mike
18th November 2006, 04:11 AM
If this is a computer other than a server, ie home laptop, desktop it is perfectly OK to disable SELINUX, mine has been disabled since FC4. SELINUX creates more problems for the home / personal user than who knows. Left it disable, but keep the firewall enabled.

cr4ck3r
18th November 2006, 07:09 PM
Just take a look around the web, SELinux is not as hard as it looks.

parish
18th November 2006, 07:47 PM
I agree with cr4ck3r, selinux is not that difficult to use; I have run with it fully enabled since it was introduced and have always managed to work through the problems with a few google searches. You can always tell if it is the source of an issue by looking in /var/log/messages, or by briefly disabling it with setenforce 0 and seeing if the problem persists.

For your specific issue I think you can correct it with the command:

chcon -t textrel_shlib_t /usr/local/matlab73/bin/glnx86/libmwlapack.so

Let us know how it works out.

Daniel

HawkBoy
21st November 2006, 01:29 AM
Well, it doesn't seem too complecated, it's just one of those classical linux situations:
I just want to run matlab and get some work done. I *could* try to learn selinux in the process, but based on what i've seen around the web, it would take at least 8 or 9 hours to read everything, do the trial and error things, etc.
I just don't have the time for that right now (maybe in a month) =).

As for your suggestion, parrish, it didn't work =)
thanks though.

parish
21st November 2006, 03:25 AM
Reminds me of a quote I read in someone's signature: "Never let the task you are trying to accomplish distract you from the study of computers." :D

That's strange that it didn't work, perhaps there are more files that need to be chcon'd. Has the error message changed? Perhaps another file is affected?

Daniel

joeyhyde
21st February 2008, 09:17 PM
For your specific issue I think you can correct it with the command:

chcon -t textrel_shlib_t /usr/local/matlab73/bin/glnx86/libmwlapack.so

Let us know how it works out.

I was having similar problems installing Matlab R2007a on Centos 5 and this worked:
chcon -t textrel_shlib_t /usr/local/matlab73/bin/glnx86/*.so

parsnips146
7th April 2009, 11:00 PM
I have also been having problems getting matlab to run on Fed 10 and i found this thread which was very helpful, the code i had to use in the end was

chcon -t textrel_shlib_t /MATHWORKS_R2008B/bin/glnx86/*.so

chcon -t textrel_shlib_t /MATHWORKS_R2008B/sys/java/jre/glnx86/jre/lib/i386/client/*.so

Please note i installed my copy of matlab into /MATHWORKS_R2008B/

Thanks for your help

James

jmelody
1st October 2009, 11:15 PM
Thanks all for the very helpful thread.

I was having trouble getting matlab R2009b to run in Fedora 11. I got the following error after installation when I attempted to run matlab with SELinux in enforcing mode.

/usr/local/matlab/matlab2009b/bin/glnxa64/MATLAB: error while loading shared libraries: /usr/local/matlab/matlab2009b/bin/glnxa64/../../bin/glnxa64/../../bin/glnxa64/libtbb.so.2: cannot restore segment prot after reloc: Permission denied

When I switched SELinux to permissive mode, matlab would run fine.

As suggested in previous posts, I was able to get matlab to run with SELinux in enforcing mode after running the following commands in the matlab installation directory (/usr/local/matlab in my case).

find . -name '*.so' -print -exec chcon -t textrel_shlib_t {} \;
find . -name '*.so.*' -print -exec chcon -t textrel_shlib_t {} \;

Note that this is slightly different than previous posts: I had to run chcon not only on .so files, but also on .so.* files.

neelima
12th March 2010, 05:29 AM
Hi all,

I too got the same problem as mentioned above by the users. I have installed MATLAB R2009B in Centos. So, i followed the suggestions given by all of you and rectified it by typing,

chcon -t textrel_shlib_t '/usr/local/MATHWORKS_R2008B/bin/glnxa64/libtbb.so.2'

The above command is working, and now, when i try to run matlab it is giving the following error

License checkout failed.
License Manager Error -96
MATLAB is unable to connect to the license server.
Make sure that the MATLAB client machine can communicate with the hostname listed in the SERVER line
of the license file, and that the port listed in the SERVER line is not blocked by a firewall.

Troubleshoot this issue by visiting:
http://www.mathworks.com/support/lme/R2009b/96

Diagnostic Information:
Feature: MATLAB
License path: /root/.matlab/R2009b_licenses:/usr/local/MATHWORKS_R2009B/licenses/license.dat:/usr/local/MATHWORKS_
R2009B/licenses/network.lic
FLEXnet Licensing error: -96,7. System Error: 2

So, please suggest me, what to do next? How to solve this problem, Thing is, we dont have any system administrators like, to help us, in our institute and I am totally new to Linux. I myself has installed matlab and working on that. Please reply as early as possible.

Thanku
Regards,
Neelima

HawkBoy
13th March 2010, 02:08 AM
Your issue is not linux-specific.

You seem to have a license issue. Do you have a valid license?

If so, you should try to follow the steps in the troubleshooting page. They're actually useful.

neelima
15th March 2010, 05:09 AM
Yaa, We have a valid license. And I deleted the existing one, and again copy pasted the license text file, once again and tried. But still, it is showing the same problem.

Please help me, how to go further

duende
16th March 2010, 08:32 PM
Just to make sure: did you start the license manager before starting matlab? I do not use matlab myself, but once I installed it for a friend and I remember that it was necessary (it was a different version - I think 7.5).

Another problem was that I had to manually add the hostname to /etc/hosts (don't know why it was not there in the first place, but it wasn't) Actually, even if the license file only contained IP it was necessary.

You posted in a thread about matlab + selinux. Can you run matlab with selinux disabled? If not, I would recommend to temporarily disable selinux, try to get the thing running and then eventually go back to resolving any selinux problems.

neelima
17th March 2010, 11:29 AM
Yaa..... I have valid license, and by following the installation.doc pdf I have installed. And after installation, I have activated the license manager file also.

After completing all the procedures, I signed out, restarted the pc and tried to run matlab by typing matlab in the terminal.

[prof.sas@localhost ~]$ matlab

bash: matlab: command not found

[prof.sas@localhost ~]$

But it is telling command not found. The same installation and after installation procedures I tried twice. This time, it is not showing any license manager, flexnet errors, like, as I wrote before. But matlab itself is not found it is telling.

I have installed matlab in root (super user) in the folder /usr/local/matlabr2009b. And copy pasted the license.dat file, by creating a new folder, license, because, during the installation time, it is asking for the path of the license file.

Hope anyone expert in the matlab installation would help me

Thanku in advance.

Reply as early as possible.
Neelima

duende
17th March 2010, 09:23 PM
[prof.sas@localhost ~]$ matlab

bash: matlab: command not found

[prof.sas@localhost ~]$


This only means that the directory containing matlab is not in your PATH variable.


I have installed matlab in root (super user) in the folder /usr/local/matlabr2009b. And copy pasted the license.dat file, by creating a new folder, license, because, during the installation time, it is asking for the path of the license file.

You probably have a file called matlab somewhere in /usr/local/matlabr2009b/bin or in /usr/local/bin.
Find where it is. If you have difficulties with that you can type (the first command as root (and it will take a while)):

updatedb
locate bin/matlab
Then run matlab using the whole path, e.g.

/usr/local/matlabr2009b/bin/matlab

To start matlab by simply typing just one word "matlab" you have to either add the folder where it sits to your PATH (this can be done by editing the file .bash_profile which is in your /home/username directory (note: .bash_profile is a hidden file). You should have there something that looks like

PATH=$PATH:$HOME/bin:/usr/local/bin
just add there what you need, :/usr/local/matlabr2009b/bin in this example)

The other option is to create a soft link in some directory which already is in your path variable (/usr/bin is surely there). For instance, assuming that your executable is /usr/local/matlabr2009b/bin/matlab and you want to create a link in /usr/bin you should type (as root):


ln -s /usr/local/matlabr2009b/bin/matlab /usr/bin/matlab

neelima
18th March 2010, 05:31 AM
Thanku Duende,

Now, matlab is running but once again the same old problem came into picture, License manager error 96

In the Matlab installation document, the section "After You Install Matlab" it is written that we should start license manager to run for matlab. As given in that I tried to run the "lmstart" shell script, in the folder "/usr/local/matlabr2009b/etc" folder. But it is showing the following error:

The following lines in your license file were treated as comments . . .
Check that you do not have license lines split incorrectly across more
than one line.
-----------------------------------------------------------------------
line# line
167
-----------------------------------------------------------------------

Checking license file for local hostname and local hostid . . .
ping: unknown host leo0

Error: Your host does not match any SERVER line in your license
file. Your local lmhostid(s) are:

0015600f1d72

Your hostname is: localhost.localdomain

The SERVER line(s) are:

-----------------------------------------------
SERVER leo0 001b7831af50 1711
-----------------------------------------------

Please stop, fix the problem, and try again . . .

Continue to start up license manager? y/[n]) y
Taking down any existing license manager daemons . . .

No license manager daemons running . . .

Starting license manager . . .

Debug logfile = /var/tmp/lm_TMW.log
Waiting 300 secs for MATLAB vendor daemon to come up . . .
Type your interrupt character (usually CTRL-C) to quit.
Time = 3 secs : still waiting . . .
Time = 30 secs : still waiting . . .
------------------------------------------------------------------------
Thu Mar 18 09:51:09 IST 2010 LM_LOGFILE (last 2 lines)
134 9:50:42 (lmgrd) Valid license server system hosts are: "leo0"
135 9:50:42 (lmgrd) Using license file "/var/tmp/lm_TMW.dat"
------------------------------------------------------------------------
Time = 60 secs : still waiting . . .
------------------------------------------------------------------------
Thu Mar 18 09:51:39 IST 2010 LM_LOGFILE (last 2 lines)
134 9:50:42 (lmgrd) Valid license server system hosts are: "leo0"
135 9:50:42 (lmgrd) Using license file "/var/tmp/lm_TMW.dat"
------------------------------------------------------------------------


........................... ............................. like that
------------------------------------------------------------------------
Time = 300 secs : time limit reached . . .
------------------------------------------------------------------------
Thu Mar 18 09:55:41 IST 2010 LM_LOGFILE (last 10 lines)
126 9:50:42 (lmgrd) www.acresso.com for more details on how to
127 9:50:42 (lmgrd) obtain an evaluation copy of FLEXnet Manager
128 9:50:42 (lmgrd) for your enterprise.
129 9:50:42 (lmgrd)
130 9:50:42 (lmgrd) -----------------------------------------------
131 9:50:42 (lmgrd)
132 9:50:42 (lmgrd)
133 9:50:42 (lmgrd) "localhost.localdomain": Not a valid server hostname, exiting.
134 9:50:42 (lmgrd) Valid license server system hosts are: "leo0"
135 9:50:42 (lmgrd) Using license file "/var/tmp/lm_TMW.dat"
------------------------------------------------------------------------


I verified and confirmed that we are having a licensed version and there is no problem, in the license.dat file. Also when i verify the hostname by using /etc/hosts it is telling the system hostname is

127.0.0.1 localhost.localdomain localhost

But here, in the lmstart program, it is showing the hostaname as

Error: Your host does not match any SERVER line in your license
file. Your local lmhostid(s) are:

0015600f1d72

Your hostname is: localhost.localdomain


I think, once I fix this problem, I may be able to run the matlab. Please do help me

Thanks & Regards,
Neelima

BugRocks1
18th March 2010, 11:13 AM
It has to be mathlab or a mathlab like would do?

I use octave to play with things and runs mathlab code(except those that use the GUI infra-structure in mathlab).

Also a good replacement is SAGE.

duende
18th March 2010, 04:25 PM
As I see it, you've got two problems. One is this:


The following lines in your license file were treated as comments . . .
Check that you do not have license lines split incorrectly across more
than one line.

Have you checked the license file? Each entry for each toolbox should be in one line, if they are split into more lines you get an error. (I am surprised though, that this error did not appear during installation, have you changed anything later?). I do not remember off hand the format of the license file, but you might be able to figure it out. The lines should be fairly long.

Unfortunately it is not a good idea to post your license file on the forum, but if you cannot figure it out yourself, you could try to copy a part of the license file, CHANGE the numbers and then post it. When I see this I might be able to tell you where the line breaks should be.


Your other problem is


Checking license file for local hostname and local hostid . . .
ping: unknown host leo0

Error: Your host does not match any SERVER line in your license
file. Your local lmhostid(s) are:

0015600f1d72

Your hostname is: localhost.localdomain

The SERVER line(s) are:

-----------------------------------------------
SERVER leo0 001b7831af50 1711
-----------------------------------------------

What puzzles me here is that the lmhostid of your localhost is different than the one in the SERVER's line. What I would try (not sure if it would work) is to either add leo0 to /etc/hosts (to the line starting with 127.0.0.1) or else to modify the license.dat file. Here I would try two things: replacing only "leo0" by localhost.localdomain or replacing both leo0 and the hostid by your lmhostid 0015600f1d72 and check if it would help.

Is this
-----------------------------------------------
SERVER leo0 001b7831af50 1711
-----------------------------------------------
a part of your license file that you got after the matlab installation? (I seem to remember that during an installation matlab adds two lines to the license file - one of them being the SERVER line). Or is it a part of the license file that you got from your computer system administrator?

I would also check if there is anything informative in a file which starts the license manager (any parameters license manager starts with?).

When I installed matlab for my friend, he got from his college the license file which already contained a server line, and the second line following the server line (plus lines for toolboxes, of course). I did not know what to do, so I put the whole file as license.dat in the directory where matlab was to be installed. Then I installed matlab and after the installation the file license.dat was transferred into etc/license.dat and two more lines were added: the SERVER line + the next line. The license manager would not start (complaining about having two server lines) so I commented out two lines, but I cannot remember whether I commented out two old ones, or two new ones, or one old and one new. Something like this did the trick.

Lin YANG
12th April 2010, 06:35 AM
matlab r2008a
I use matlab r2008a, with my selinux on. the key issue is the owner of the dir you install the matlab in: it must be the user, not the root user. this is my method:
$ mkdir matlab
$ mkdir matlabmedia
$ su
# mv matlab /usr/share/
# mount -t iso9660 matu2008a.iso /home/myname/matlabmedia
# exit
$ cd matlabmedia
$ ./INSTALL
then, install the matlab files into the /usr/share/matlab dir. when the install program ask for bin dir, usr the /home/myname/bin instead of the default dir by the program.

this method keeps all the file needed in your OWN dir, so you can enjoy it.

Regards.

sureshmscau
23rd April 2011, 03:41 PM
Thank u Iron_mike. I am using FC14. I got my problem solved by reading your thread.