# Misadventures in non-vnc Matlab app construction

**URL:** <https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837>\
**Category:** Get Help\
**Tags:** question\
**Created:** [December 10, 2021, 8:32pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837 "2021-12-10T20:32:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonbuechler](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jasonbuechler/32/302_2.png) [@jasonbuechler](https://discourse.openondemand.org/u/jasonbuechler)\
**Post date:** [December 10, 2021, 8:32pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/1 "2021-12-10T20:32:05Z")

</div>

Firstly, my apologies if I should be directly contacting VT-ARC or the Mathworks people about this – I thought surely someone else would eventually ask about this topic (given the intense interest during the tips-n-tricks call) but I’ve not seen anything here, nor in ARC’s github-issues. If there’s a better venue (e.g. discord/slack/etc), please let me know, thanks!

Trying to follow [the Dev Guide from VT](https://github.com/AdvancedResearchComputing/OnDemandApps/blob/main/bc_vt_matlab_html/DevGuide.md), I’ve made the following observations/additions/etc/etc…

The guide [mentions modifying manifest.yml](https://github.com/AdvancedResearchComputing/OnDemandApps/blob/c94b3bb4c8d1c17fdfc5515890482f50355fd607/bc_vt_matlab_html/DevGuide.md?plain=1#L45), but I wonder if that is supposed to suggest modifying form.yml? (To specify your cluster and customize fields.)

Similarly, although the guide does mention updating [template/script.sh.erb](https://github.com/AdvancedResearchComputing/OnDemandApps/blob/main/bc_vt_matlab_html/template/script.sh.erb) for the path to the .sif image, I also needed to update several of the `bind` parameters. Beyond the obvious filesystem differences, though, it was definitely not clear to me at first that $MATLAB\_DIR and $TMPFS seem to be VT-site-specific environment variables. I also had to bind our newer version of readline’s ‘libhistory’.

```diff
[jason@wind] $ cd ~/ondemand/dev/bc_vt_matlab_html/template
[jason@wind] $ diff -u script.sh.erb-origBindings script.sh.erb
--- script.sh.erb-origBindings 2021-11-24 12:07:04.000000000 -0700
+++ script.sh.erb 2021-12-10 11:13:59.033674779 -0700
@@ -20,12 +20,13 @@
+echo "SUSPECTED VT-SPECIFIC VARS: MATLAB_DIR=$MATLAB_DIR ... TMPFS=$TMPFS"
 export SINGULARITYENV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
 export SINGULARITYENV_PATH=$PATH
 singularity run --nv --writable-tmpfs \
- --bind=$MATLAB_DIR:/opt/matlab,$TMPFS:/tmp,/work/${USER},/projects \
- --bind=`pwd`/matlab.rc:/mathworks.rc,/cm,/etc/slurm/slurm.conf \
- --bind=/lib64/libhistory.so.6:/lib/x86_64-linux-gnu/libhistory.so.6 \
+ --bind=/packages/matlab/R2021b:/opt/matlab,/tmp,/projects \
+ --bind=`pwd`/matlab.rc:/mathworks.rc,/etc/slurm/slurm.conf \
+ --bind=/lib64/libhistory.so.7:/lib/x86_64-linux-gnu/libhistory.so.6 \
     --bind=/usr/lib64/libmunge.so.2:/lib/x86_64-linux-gnu/libmunge.so.2,/var/run/munge \
     --bind=`pwd`/entrypoint.sh:/entrypoint.sh \
     /home/jason/ondemand/dev/bc_vt_matlab_html/matlab.sif bash /entrypoint.sh

```

* * *

When I launch my dev Matlab app, it gets stuck “Starting”, and the app/script output indicates that matlab-jupyter-app cannot be found…

```bash
[jason@wind] $ cd ~/ondemand/data/sys/dashboard/batch_connect/dev/bc_vt_matlab_html/output/f36b9577-ac0f-4894-9adb-b3d318b6405a
[jason@wind] $ cat output.log
starting before
No modules loaded
Script starting...
Waiting for Matlab to open port 41492...
/home/jason/ondemand/data/sys/dashboard/batch_connect/dev/bc_vt_matlab_html/output/f36b9577-ac0f-4894-9adb-b3d318b6405a
module works
starting singularity
starting Matlab on cn31 using 41492
SUSPECTED VT-SPECIFIC VARS: MATLAB_DIR= ... TMPFS=
retrieved ENV variables from matlab.rc
MWI_APP_PORT=41492
MWI_BASE_URL=/matlab
TMPDIR=/tmp
MWI_EXT_URL=ood.arc.vt.edu
MLM_LICENSE_FILE=/opt/matlab/licenses/network.lic
To use the web-desktop: http://ood.arc.vt.edu/matlab/index.html
starting web matlab
/entrypoint.sh: line 30: matlab-jupyter-app: command not found

```

* * *

Though my app session is stuck starting up, I can stay in the ondemand-generated working-directory to leverage the resources it already prepared. When I interactively shell in, it’s _now_ clearly on my $PATH:

```bash
[jason@wind] $ singularity shell --nv --writable-tmpfs \
> --bind=/packages/matlab/R2021b:/opt/matlab,/tmp,/projects \
> --bind=`pwd`/matlab.rc:/mathworks.rc,/etc/slurm/slurm.conf \
> --bind=/lib64/libhistory.so.7:/lib/x86_64-linux-gnu/libhistory.so.6 \
> --bind=/usr/lib64/libmunge.so.2:/lib/x86_64-linux-gnu/libmunge.so.2,/var/run/munge \
> --bind=`pwd`/entrypoint.sh:/entrypoint.sh \
> /home/jason/ondemand/dev/bc_vt_matlab_html/matlab.sif
INFO: Could not find any nv files on this host!

Singularity> which matlab-jupyter-app
/usr/local/bin/matlab-jupyter-app

```

* * *

Now, obviously there are some variables in [template/before.sh.erb](https://github.com/AdvancedResearchComputing/OnDemandApps/blob/main/bc_vt_matlab_html/template/before.sh.erb) (that define the ephemeral matlab.rc) that everyone should be localizing; but more to the point, I can modify [template/entrypoint.sh](https://github.com/AdvancedResearchComputing/OnDemandApps/blob/main/bc_vt_matlab_html/template/entrypoint.sh) to provide the full path to `matlab-jupyter-app` to move things along.

```diff
$ diff -u entrypoint.sh-orig entrypoint.sh
--- entrypoint.sh-orig 2021-12-10 12:50:53.352527908 -0700
+++ entrypoint.sh 2021-12-10 12:51:36.872916964 -0700
@@ -27,4 +27,4 @@
 echo ""
 echo starting web matlab
-matlab-jupyter-app
+/usr/local/bin/matlab-jupyter-app

```

* * *

Unforunately, although that definitely got me closer and I can launch the app, I’m still hitting some error and not sure how to go about diagnosing/debugging it:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/141eda05edb40c95f880d5995e0166c7ee25621c.jpeg)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/1012e4dd01fc3091be08c7f632747d666c851718.jpeg)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/096e2266df0097ca6d07e1d11f371715b26c38c9.png)

Now, when I view my app sessions, this Matlab one is still appears active/available and when I click the blue “Connect” button, I get a similar looking page that has empty promises about error logs. Clicking the “Start MATLAB Session” button here starts the cycle over, at the “Starting” screenshot.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/c9c460e46f4e2b196ce2bcb4b18293a81f2a4581.jpeg)

* * *

The output.log file doesn’t show anything enlightening, and there doesn’t appear to be anything remotely special in my /var/log/ondemand-nginx logs.

```auto
$ tail -f output.log
INFO:MATLABProxyApp:MATLAB_LOG_DIR:/tmp/MWI/31511
INFO:MATLABProxyApp:MATLAB_READY_FILE:/tmp/MWI/31511/connector.securePort
INFO:MATLABProxyApp:Starting MATLAB on port 31511
INFO:MATLABProxyApp:Installing handler for signal: 1
INFO:MATLABProxyApp:Installing handler for signal: 2
INFO:MATLABProxyApp:Installing handler for signal: 3
INFO:MATLABProxyApp:Installing handler for signal: 15
MATLAB is selecting SOFTWARE OPENGL rendering.
Discovered Matlab listening on port 18154!
Generating connection YAML file...

                            < M A T L A B (R) >
                  Copyright 1984-2021 The MathWorks, Inc.
                  R2021b (9.11.0.1769968) 64-bit (glnxa64)
                             September 17, 2021

INFO:MATLABProxyApp:Waiting for MATLAB to exit...
INFO:MATLABProxyApp:MATLAB has exited with errorcode: -9
ERROR:MATLABProxyApp:MATLAB returned an unexpected error. For more details, see the log below.

INFO:MATLABProxyApp:Cleaning up matlab_ready_file.../tmp/MWI/31511/connector.securePort
INFO:MATLABProxyApp:MATLAB_LOG_DIR:/tmp/MWI/31511
INFO:MATLABProxyApp:MATLAB_READY_FILE:/tmp/MWI/31511/connector.securePort
INFO:MATLABProxyApp:Starting MATLAB on port 31511
MATLAB is selecting SOFTWARE OPENGL rendering.

                            < M A T L A B (R) >
                  Copyright 1984-2021 The MathWorks, Inc.
                  R2021b (9.11.0.1769968) 64-bit (glnxa64)
                             September 17, 2021

INFO:MATLABProxyApp:Waiting for MATLAB to exit...
INFO:MATLABProxyApp:MATLAB has exited with errorcode: -9
ERROR:MATLABProxyApp:MATLAB returned an unexpected error. For more details, see the log below.

```

Note that that is the entirety of the file, and “the long below” is evidently empty.

Suggestions?  
Thank you!  
Jason Buechler  
NAU Monsoon HPC

---

<div class="post-metadata">

**Author:** ![jasonbuechler](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jasonbuechler/32/302_2.png) [@jasonbuechler](https://discourse.openondemand.org/u/jasonbuechler)\
**Post date:** [January 6, 2022, 11:55pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/2 "2022-01-06T23:55:14Z")

</div>

A bunch of work later, I fixed some ruby typos, tweaked resources allotment, and probably some other things. But I still would appreciate some help understanding a few things:

- at the end of the entrypoint script, I don’t understand why I have to provide the full path to matlab-jupyter-app (as mentioned above, I can shell-into the container and it IS in root’s path)
- Unsure the source or significance of an “/opt/matlab/parallel\_remote” warning that appears after the MATLAB masthead, as displayed in a session’s output.log (see below)
- is it fine to leave `MWI_BASE_URL=/matlab` in before.sh? (I ask because these comments make it seem like we should be matching our OOD installation’s reverse-proxy → [OnDemandApps/Dockerfile at 609eb334cec0d95a2163500556644ac01454a256 · AdvancedResearchComputing/OnDemandApps · GitHub](https://github.com/AdvancedResearchComputing/OnDemandApps/blob/609eb334cec0d95a2163500556644ac01454a256/bc_vt_matlab_html/Dockerfiles/Dockerfile#L43-L44))
- Starting the app up takes a LONG. LONG. TIME. Much more than a few minutes, oftentimes, though not all times. strace’ing the activity on the compute-node shows it looking at an endless list of files, as though it were validating the installation base every. single. run.

Here is that “/opt/matlab/parallel\_remote” warning that appears after the MATLAB masthead, as displayed in a session’s output.log:

```auto
INFO:MATLABProxyApp:Installing handler for signal: 15
MATLAB is selecting SOFTWARE OPENGL rendering.
Discovered Matlab listening on port 58714!
Generating connection YAML file...
ESC[?1hESC=
                            < M A T L A B (R) >
                  Copyright 1984-2021 The MathWorks, Inc.
                  R2021b (9.11.0.1769968) 64-bit (glnxa64)
                             September 17, 2021

Warning: Name is nonexistent or not a directory: /opt/matlab/parallel_remote

To get started, type doc.
For product information, visit www.mathworks.com.

Starting CPP Connector on Worker
Warming up worker

```

Thanks for any input!  
–jason

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [January 24, 2022, 8:41pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/3 "2022-01-24T20:41:18Z")

</div>

Hi Jason,

we ended up not using the container, but locally installed Anaconda with the Matlab plugin, and locally installed Matlab. Our config is at [OOD-apps-v3/matlab\_html\_app at master · CHPC-UofU/OOD-apps-v3 · GitHub](https://github.com/CHPC-UofU/OOD-apps-v3/tree/master/matlab_html_app)

Though, almost all our users keep using the VNC Matlab app, probably because they are used to it.

HTH,  
Martin

---

<div class="post-metadata">

**Author:** ![gbyrket](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/gbyrket/32/894_2.png) [@gbyrket](https://discourse.openondemand.org/u/gbyrket)\
**Post date:** [January 24, 2022, 9:22pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/4 "2022-01-24T21:22:08Z")

</div>

Hi Folks.

I’ve created the following Github issue so we can track this appropriately as a trouble ticket.

> <https://github.com/OSC/ondemand/issues/1781>
>
> Firstly, my apologies if I should be directly contacting VT-ARC or the Mathworks… people about this – I thought surely someone else would eventually ask about this topic (given the intense interest during the tips-n-tricks call) but I’ve not seen anything here, nor in ARC’s github-issues. If there’s a better venue (e.g. discord/slack/etc), please let me know, thanks!
> 
> Trying to follow the Dev Guide from VT 4, I’ve made the following observations/additions/etc/etc…
> 
> The guide mentions modifying manifest.yml, but I wonder if that is supposed to suggest modifying form.yml? (To specify your cluster and customize fields.)
> 
> Similarly, although the guide does mention updating template/script.sh.erb 1 for the path to the .sif image, I also needed to update several of the bind parameters. Beyond the obvious filesystem differences, though, it was definitely not clear to me at first that $MATLAB\_DIR and $TMPFS seem to be VT-site-specific environment variables. I also had to bind our newer version of readline’s ‘libhistory’.
> 
> \[jason@wind\] $ cd ~/ondemand/dev/bc\_vt\_matlab\_html/template
> \[jason@wind\] $ diff -u script.sh.erb-origBindings script.sh.erb
> \--- script.sh.erb-origBindings 2021-11-24 12:07:04.000000000 -0700
> +++ script.sh.erb 2021-12-10 11:13:59.033674779 -0700
> @@ -20,12 +20,13 @@
> +echo "SUSPECTED VT-SPECIFIC VARS: MATLAB\_DIR=$MATLAB\_DIR ... TMPFS=$TMPFS"
> export SINGULARITYENV\_LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH
> export SINGULARITYENV\_PATH=$PATH
> singularity run --nv --writable-tmpfs \\
> 
> 
> \* --bind=$MATLAB\_DIR:/opt/matlab,$TMPFS:/tmp,/work/${USER},/projects \\
> \* --bind=\`pwd\`/matlab.rc:/mathworks.rc,/cm,/etc/slurm/slurm.conf \\
> \* --bind=/lib64/libhistory.so.6:/lib/x86\_64-linux-gnu/libhistory.so.6 \\
> \* --bind=/packages/matlab/R2021b:/opt/matlab,/tmp,/projects \\
> \* --bind=\`pwd\`/matlab.rc:/mathworks.rc,/etc/slurm/slurm.conf \\
> \* --bind=/lib64/libhistory.so.7:/lib/x86\_64-linux-gnu/libhistory.so.6 \\
> --bind=/usr/lib64/libmunge.so.2:/lib/x86\_64-linux-gnu/libmunge.so.2,/var/run/munge \\
> --bind=\`pwd\`/entrypoint.sh:/entrypoint.sh \\
> /home/jason/ondemand/dev/bc\_vt\_matlab\_html/matlab.sif bash /entrypoint.sh
> 
> 
> 
> ┆Issue is synchronized with this \[Asana task\](https://app.asana.com/0/1201625178070145/1201711986758341) by \[Unito\](https://www.unito.io)

Thanks,  
-gerald

---

<div class="post-metadata">

**Author:** ![rsettlag](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/rsettlag/32/78_2.png) [@rsettlag](https://discourse.openondemand.org/u/rsettlag)\
**Post date:** [January 28, 2022, 3:46pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/5 "2022-01-28T15:46:31Z")

</div>

Oh sorry, I missed this as I was taking a bit of leave. I think I need to point the Mathworks folk here as this just kinda worked for us. I did do some tweaking to get it more specific to our environment like binding in more directories. I will send them this link.

---

<div class="post-metadata">

**Author:** ![nickchoi-mw](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/nickchoi-mw/32/874_2.png) [@nickchoi-mw](https://discourse.openondemand.org/u/nickchoi-mw)\
**Post date:** [January 28, 2022, 6:15pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/6 "2022-01-28T18:15:13Z")

</div>

Hi Jason,

I work at MathWorks as a product manager and I’d love to follow up with you offline to help address your questions and move this forward.

I sent you an email (based on what’s listed in the NAU directory) - please send me a message if there is a better way to get in touch.

Thanks,  
Nick Choi  
MathWorks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [July 27, 2022, 6:15pm UTC](https://discourse.openondemand.org/t/misadventures-in-non-vnc-matlab-app-construction/1837/7 "2022-07-27T18:15:53Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
