Filter löschen
Filter löschen

Permission denied for executing batch file on linux compute node

20 Ansichten (letzte 30 Tage)
On a local unbuntu 20.04 os, I have followed the MATLAB example of building code-generated model file (as rsim.tlc system target) on this link. Everything worked fine (using MATLAB R2020b update 6). But when I migrated the files onto a compute node in a university cluster (with MATLAB R2020b initial version), and repeating the same steps for calling the batch script, now matlab is giving me error saying permission denied. The permission denied error came when the code was executed to the following step in the example:
batFileName = 'rtwdemo_rsim_vdp_run_scr';
[stat, res] = system(['.' filesep batFileName]);
if stat ~= 0
error(['Error running batch file ''', batFileName, ''' :', res]);
end
I packaged the above script into a file named run_batch.m and the error was:
Error using run_batch (line 4)
Error running batch file 'rtwdemo_rsim_vdp_run_scr' :/bin/bash: ./rtwdemo_rsim_vdp_run_scr: Permission denied
I am not sure what `Permission denied` indicates out of the system() function. Sure, I don't have sudo (super-user) status on the cluster node. But I didn't need the sudo status to run this example perfectly in my local Ubuntu 20.04 laptop. So I'm stuck here. Eventuall I'd like to be able to run this exmaple on the cluster node.
Any tip is appreciated!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 11 Feb. 2022
Bearbeitet: Walter Roberson am 11 Feb. 2022
!chmod ugo+x ./rtwdemo_rsim_vdp_run_scr
That should only be needed once.
If the file happens to be on a filesystem that is mounted with no-execute set, then a different approach would be needed.
  2 Kommentare
Tong Zhao
Tong Zhao am 11 Feb. 2022
Bearbeitet: Tong Zhao am 11 Feb. 2022
Hi Walter, thank you, I just tried, and I get this error:
[zhao1991@exp-9-55 TongFiles]$ !chmod ugo+x ./rtwdemo_rsim_vdp_run_scr
bash: !chmod: event not found
Update: ok, my bad, there shouldn't be the exclamation mark at the begining, so I applied
[zhao1991@exp-9-55 TongFiles]$ chmod ugo+x ./rtwdemo_rsim_vdp_run_scr
And the previous error went away. However, now I have a new error instead:
Error using run_script (line 4)
Error running batch file 'rtwdemo_rsim_vdp_run_scr' :./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@1 -o rtwdemo_rsim_vdp_run1.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@2 -o rtwdemo_rsim_vdp_run2.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@3 -o rtwdemo_rsim_vdp_run3.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
Now it seems that the cluter node CAN access the batch script now, and it correctly echo'ed / printed the commands intended in the batch script. But the actual execution of the model was not done, as I didn't see any results files been produced, and the error came immediately.
The batch script (shortened) is the following:
echo "./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@1 -o rtwdemo_rsim_vdp_run1.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1"
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@1 -o rtwdemo_rsim_vdp_run1.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
echo "./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@2 -o rtwdemo_rsim_vdp_run2.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1"
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@2 -o rtwdemo_rsim_vdp_run2.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
echo "./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@3 -o rtwdemo_rsim_vdp_run3.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1"
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@3 -o rtwdemo_rsim_vdp_run3.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
Next I tried to find out what exact [stat,res] did system() function output, so I added the following before the if statement to generate error message:
disp('Displaying stat:')
disp(stat)
disp('Displaying res:')
disp(res)
I got this following information:
Displaying stat:
126
Displaying res:
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@1 -o rtwdemo_rsim_vdp_run1.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@2 -o rtwdemo_rsim_vdp_run2.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@3 -o rtwdemo_rsim_vdp_run3.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
Now I'm stuck again, but with a different error.. what does stat = 126 mean? do you still have a tip?
Tong Zhao
Tong Zhao am 11 Feb. 2022
Bearbeitet: Tong Zhao am 11 Feb. 2022
Update: I realized that running the batch script involved calling a few files, and I only changed permission on one of them. After changing the permission on all of them using
chmod ugo+x *
The stat=126 error went away, but I got a stat=1 error instead. I don't know what it means...
Displaying stat:
1
Displaying res:
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@1 -o rtwdemo_rsim_vdp_run1.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@2 -o rtwdemo_rsim_vdp_run2.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
./rtwdemo_rsim_vdp -p rtwdemo_rsim_vdp_prm_sets.mat@3 -o rtwdemo_rsim_vdp_run3.mat -L 3600 1> rtwdemo_rsim_vdp_run_scr.log 2>&1
Update: ok, I further checked a log that is produced by the batch script, and it says:
/lib64/libm.so.6: version `GLIBC_2.29' not found (required by ./rtwdemo_rsim_vdp)
Seems like I need a specific glibc 2.29 package for the cluster node. I've asked the admin, and got the feedback that glibc is at the core of the system, it is unlikely I can get around it, so if I needed to run this I'll have to downgrade to fit what is available in the cluster node. But this is a whole another issue. For the initial question, Walter has answered it correctly.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by