Matlab Interactive App with Xfce and Rocky 8 RHEL/8

Hello, I am using OnDemand version: 2.0.31 and I’m halfway to getting the Interactive Matlab App working. With the usual script.sh.erb it doesn’t worked and i always got an Connection refused Error. I worked it around with help of other Discourse Topics where @JeffOhrstorm mentioned to put sleep in between the script.

Now i get a Launch Button on the Interactive App Session page but when i start the VNC Session i cant see Matlab, but i can see the desktop. So when i start a Terminal from the desktop and first invoke : module load matlab/r2022a and then matlab -desktop i can successfully start Matlab.

So it seems like the module load cmd and matlab -desktop doesnt get invoked. Also Output.log doesnt show any invocation or am i missing something ?

module file:


#%Module 1.0
#
#  matlab module
#
conflict                matlab
prepend-path            PATH            /usr/local/MATLAB/R2022a/bin
prepend-path            SYS             /usr/local/MATLAB/R2022a/sys

script.sh.erb:

#!/usr/bin/env bash
unset XDG_RUNTIME_DIR
export XDG_RUNTIME_DIR="/tmp/user/$(id -u)"

# Clean the environment
module purge

# Set working directory to home directory
cd "${HOME}"

# Launch Xfce Window Manager and Panel
#

export SEND_256_COLORS_TO_REMOTE=1
export XDG_CONFIG_HOME="<%= session.staged_root.join("config") %>"
export XDG_DATA_HOME="<%= session.staged_root.join("share") %>"
export XDG_CACHE_HOME="$(mktemp -d)"
module restore
set -x
eval $(dbus-launch --sh-syntax)
#xfwm4 --sm-client-disable &
xfwm4 --compositor=off --sm-client-disable &
sleep 5
xsetroot -solid "#D3D3D3"
xfsettingsd --sm-client-disable &
xfce4-panel --sm-client-disable 


# Load the required environment
module load <%= context.version %>
module list 
set -x
matlab -desktop

Output.log says:

Setting VNC password...
Starting VNC server...

Desktop 'TurboVNC: node0.omnia.test:1 (test4)' started on display node0.omnia.test:1

Log file is vnc.log
Successfully started VNC server on node0.omnia.test:5901...
Script starting...
Starting websocket server...
The system default contains no modules
  (env var: LMOD_SYSTEM_DEFAULT_MODULES is empty)
  No changes in loaded modules

++ dbus-launch --sh-syntax
+ eval 'DBUS_SESSION_BUS_ADDRESS='\''unix:abstract=/tmp/dbus-9BWEowuTVY,guid=1f4d370813b0f0ad3d4a4ed2644270b3'\'';' export 'DBUS_SESSION_BUS_ADDRESS;' 'DBUS_SESSION_BUS_PID=115878;' 'DBUS_SESSION_BUS_WINDOWID=2097153;'
++ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9BWEowuTVY,guid=1f4d370813b0f0ad3d4a4ed2644270b3
++ export DBUS_SESSION_BUS_ADDRESS
++ DBUS_SESSION_BUS_PID=115878
++ DBUS_SESSION_BUS_WINDOWID=2097153
+ sleep 5
+ xfwm4 --compositor=off --sm-client-disable
WebSocket server settings:
  - Listen on :44803
  - No SSL/TLS support (no cert file)
  - Backgrounding (daemon)

(xfwm4:115879): GLib-CRITICAL **: 13:17:07.799: g_str_has_prefix: assertion 'prefix != NULL' failed
Scanning VNC log file for user authentications...
Generating connection YAML file...
+ xsetroot -solid '#D3D3D3'
+ xfce4-panel --sm-client-disable
+ xfsettingsd --sm-client-disable

(xfsettingsd:115969): GLib-CRITICAL **: 13:17:12.680: g_str_has_prefix: assertion 'prefix != NULL' failed

(xfsettingsd:115969): GLib-GObject-CRITICAL **: 13:17:12.683: g_value_get_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed

(xfsettingsd:115969): GLib-GObject-CRITICAL **: 13:17:12.684: g_value_get_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed

(xfsettingsd:115969): GLib-GObject-CRITICAL **: 13:17:12.686: g_value_get_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
Setting VNC password...
Generating connection YAML file...
Failed to connect to session manager: Failed to connect to the session manager: SESSION_MANAGER environment variable not defined

Setup:
OS (Login-Node and Compute-Nodes) : Rocky Linx 8.5
OOD v. 2.0.31
TurboVNC v.3.0.3
xfce4 : xfce4-panel 4.16.3 (Xfce 4.16)

What i see:

Sorry for the long text I hope someone can help me with this matter.

Greetings

Omnia

Hi and welcome!

I think you’re on to something here. The set -x is a big helper here because it shows what’s being invoked and what’s not.

I just got this to work, by wrapping it all in a () & block.

(
  export SEND_256_COLORS_TO_REMOTE=1
  export XDG_CONFIG_HOME="<%= session.staged_root.join("config") %>"
  export XDG_DATA_HOME="<%= session.staged_root.join("share") %>"
  export XDG_CACHE_HOME="$(mktemp -d)"
  module restore
  set -x
  eval $(dbus-launch --sh-syntax)
  xfwm4 --compositor=off --sm-client-disable &
  xsetroot -solid "#D3D3D3"
  xfsettingsd --sm-client-disable &
  xfce4-panel --sm-client-disable
) &

You may just need to background this,

I.e., put an ampersand at the end.

xfce4-panel --sm-client-disable &

Hi Jeff, thank you for your fast response. Due to a cold i wasn’t at work. I tried to wrap it up in a block but then the VNC process gets killed.

/var/log/messages says:

Apr 25 15:31:02 node0 systemd[1]: Started Session 15 of user root.
Apr 25 15:36:51 node0 su[13572]: (to test4) root on pts/1
Apr 25 15:40:43 node0 systemd[1]: Starting system activity accounting tool...
Apr 25 15:40:43 node0 su[13711]: (to test4) root on none
Apr 25 15:40:43 node0 systemd[1]: Created slice User Slice of UID 443600032.
Apr 25 15:40:43 node0 systemd[1]: Starting User runtime directory /run/user/443600032...
Apr 25 15:40:43 node0 systemd[1]: sysstat-collect.service: Succeeded.
Apr 25 15:40:43 node0 systemd[1]: Started system activity accounting tool.
Apr 25 15:40:43 node0 systemd[1]: Started User runtime directory /run/user/443600032.
Apr 25 15:40:43 node0 systemd[1]: Starting User Manager for UID 443600032...
Apr 25 15:40:43 node0 systemd[13717]: Reached target Paths.
Apr 25 15:40:43 node0 systemd[13717]: Started Mark boot as successful after the user session has run 2 minutes.
Apr 25 15:40:43 node0 systemd[13717]: Listening on Sound System.
Apr 25 15:40:43 node0 systemd[13717]: Reached target Timers.
Apr 25 15:40:43 node0 systemd[13717]: Starting D-Bus User Message Bus Socket.
Apr 25 15:40:43 node0 systemd[13717]: Listening on Multimedia System.
Apr 25 15:40:43 node0 systemd[13717]: Listening on D-Bus User Message Bus Socket.
Apr 25 15:40:43 node0 systemd[13717]: Reached target Sockets.
Apr 25 15:40:43 node0 systemd[13717]: Reached target Basic System.
Apr 25 15:40:43 node0 systemd[1]: Started User Manager for UID 443600032.
Apr 25 15:40:43 node0 systemd[13717]: Starting Sound Service...
Apr 25 15:40:43 node0 systemd[1]: Started Session c13 of user test4.
Apr 25 15:40:44 node0 systemd[1]: session-c13.scope: Succeeded.
Apr 25 15:40:44 node0 systemd[13717]: Started D-Bus User Message Bus.
Apr 25 15:40:44 node0 systemd[13717]: Started Sound Service.
Apr 25 15:40:44 node0 systemd[13717]: Reached target Default.
Apr 25 15:40:44 node0 systemd[13717]: Startup finished in 300ms.
Apr 25 15:40:45 node0 dbus-daemon[13914]: [session uid=443600032 pid=13912] Activating service name='org.a11y.Bus' requested by ':1.0' (uid=443600032 pid=13915 comm="xfwm4 --compositor=off --sm-client-disable ")
Apr 25 15:40:45 node0 dbus-daemon[13914]: [session uid=443600032 pid=13912] Successfully activated service 'org.a11y.Bus'
Apr 25 15:40:45 node0 org.a11y.Bus[13914]: dbus-daemon[13985]: Activating service name='org.a11y.atspi.Registry' requested by ':1.0' (uid=443600032 pid=13915 comm="xfwm4 --compositor=off --sm-client-disable ")
Apr 25 15:40:45 node0 org.a11y.Bus[13914]: dbus-daemon[13985]: Successfully activated service 'org.a11y.atspi.Registry'
Apr 25 15:40:45 node0 org.a11y.Bus[13914]: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
Apr 25 15:40:45 node0 dbus-daemon[13914]: [session uid=443600032 pid=13912] Activating service name='org.xfce.Xfconf' requested by ':1.3' (uid=443600032 pid=13915 comm="xfwm4 --compositor=off --sm-client-disable ")
Apr 25 15:40:45 node0 dbus-daemon[13914]: [session uid=443600032 pid=13912] Successfully activated service 'org.xfce.Xfconf'
Apr 25 15:40:54 node0 systemd[1]: Stopping User Manager for UID 443600032...
Apr 25 15:40:54 node0 systemd[13717]: Stopping D-Bus User Message Bus...
Apr 25 15:40:54 node0 systemd[13717]: Stopped target Default.
Apr 25 15:40:54 node0 systemd[13717]: Stopping Sound Service...
Apr 25 15:40:54 node0 systemd[13717]: Stopped D-Bus User Message Bus.
Apr 25 15:40:54 node0 systemd[13717]: Stopped Sound Service.
Apr 25 15:40:54 node0 systemd[13717]: Stopped target Basic System.
Apr 25 15:40:54 node0 systemd[13717]: Stopped target Sockets.
Apr 25 15:40:54 node0 systemd[13717]: Closed Multimedia System.
Apr 25 15:40:54 node0 systemd[13717]: Closed D-Bus User Message Bus Socket.
Apr 25 15:40:54 node0 systemd[13717]: Stopped target Paths.
Apr 25 15:40:54 node0 systemd[13717]: Stopped target Timers.
Apr 25 15:40:54 node0 systemd[13717]: Stopped Mark boot as successful after the user session has run 2 minutes.
Apr 25 15:40:54 node0 systemd[13717]: Closed Sound System.
Apr 25 15:40:54 node0 systemd[13717]: Reached target Shutdown.
Apr 25 15:40:54 node0 systemd[13717]: Starting Exit the Session...
Apr 25 15:40:54 node0 systemd[1]: user@443600032.service: Succeeded.
Apr 25 15:40:54 node0 systemd[1]: Stopped User Manager for UID 443600032.
Apr 25 15:40:54 node0 systemd[1]: Stopping User runtime directory /run/user/443600032...
Apr 25 15:40:54 node0 systemd[1]: run-user-443600032.mount: Succeeded.
Apr 25 15:40:54 node0 systemd[1]: user-runtime-dir@443600032.service: Succeeded.
Apr 25 15:40:54 node0 systemd[1]: Stopped User runtime directory /run/user/443600032.
Apr 25 15:40:54 node0 systemd[1]: Removed slice User Slice of UID 443600032.
Apr 25 15:40:57 node0 org.a11y.Bus[13914]: X connection to :1 broken (explicit kill or server shutdown).
Setting VNC password...
Starting VNC server...

Desktop 'TurboVNC: node0.omnia.test:1 (test4)' started on display node0.omnia.test:1

Log file is vnc.log
Successfully started VNC server on node0.omnia.test:5901...
Script starting...
Starting websocket server...
The system default contains no modules
  (env var: LMOD_SYSTEM_DEFAULT_MODULES is empty)
  No changes in loaded modules

++ dbus-launch --sh-syntax
+ eval 'DBUS_SESSION_BUS_ADDRESS='\''unix:abstract=/tmp/dbus-sU5HYs49N4,guid=8c220a3b9ccc2a702de64aea6447a19f'\'';' export 'DBUS_SESSION_BUS_ADDRESS;' 'DBUS_SESSION_BUS_PID=219184;' 'DBUS_SESSION_BUS_WINDOWID=2097153;'
++ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-sU5HYs49N4,guid=8c220a3b9ccc2a702de64aea6447a19f
++ export DBUS_SESSION_BUS_ADDRESS
++ DBUS_SESSION_BUS_PID=219184
++ DBUS_SESSION_BUS_WINDOWID=2097153
+ xfwm4 --compositor=off --sm-client-disable

Currently Loaded Modules:
  1) matlab/r2022a

 

+ matlab -desktop

(xfwm4:219186): GLib-CRITICAL **: 11:47:11.824: g_str_has_prefix: assertion 'prefix != NULL' failed
WebSocket server settings:
  - Listen on :40207
  - No SSL/TLS support (no cert file)
  - Backgrounding (daemon)
Scanning VNC log file for user authentications...
Generating connection YAML file...
MATLAB is selecting SOFTWARE OPENGL rendering.
Cleaning up...
Killing Xvnc process ID 219146
+ sleep 5
---------------------------------------------------------------------------
Error: Activation cannot proceed. You may either:
1. Set an X11 display, and restart the activation process
2. Use the silent activation feature
3. Activate using the license center
---------------------------------------------------------------------------
(
export SEND_256_COLORS_TO_REMOTE=1
export XDG_CONFIG_HOME="<%= session.staged_root.join("config") %>"
export XDG_DATA_HOME="<%= session.staged_root.join("share") %>"
export XDG_CACHE_HOME="$(mktemp -d)"
module restore
set -x
eval $(dbus-launch --sh-syntax)
xfwm4 --compositor=off --sm-client-disable 
sleep 5
xsetroot -solid "#D3D3D3"
xfsettingsd --sm-client-disable 
xfce4-panel --sm-client-disable
)&

I tried also to not wrap up all of it and only set xfce4-panel --sm-client-disable in background then i get a VNC connection but i only see a black screen output.log unfortunately says nothing :frowning: .

Setting VNC password...
Starting VNC server...

Desktop 'TurboVNC: node0.omnia.test:1 (test4)' started on display node0.omnia.test:1

Log file is vnc.log
Successfully started VNC server on node0.omnia.test:5901...
Script starting...
Starting websocket server...
The system default contains no modules
  (env var: LMOD_SYSTEM_DEFAULT_MODULES is empty)
  No changes in loaded modules

++ dbus-launch --sh-syntax
+ eval 'DBUS_SESSION_BUS_ADDRESS='\''unix:abstract=/tmp/dbus-cPiZMVpwX5,guid=96d986b4cde6db2e792e52876447a275'\'';' export 'DBUS_SESSION_BUS_ADDRESS;' 'DBUS_SESSION_BUS_PID=219987;' 'DBUS_SESSION_BUS_WINDOWID=2097153;'
++ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cPiZMVpwX5,guid=96d986b4cde6db2e792e52876447a275
++ export DBUS_SESSION_BUS_ADDRESS
++ DBUS_SESSION_BUS_PID=219987
++ DBUS_SESSION_BUS_WINDOWID=2097153
+ xfwm4 --compositor=off --sm-client-disable
WebSocket server settings:
  - Listen on :12922
  - No SSL/TLS support (no cert file)
  - Backgrounding (daemon)

(xfwm4:219988): GLib-CRITICAL **: 11:50:45.246: g_str_has_prefix: assertion 'prefix != NULL' failed
Scanning VNC log file for user authentications...
Generating connection YAML file...
Setting VNC password...
Generating connection YAML file...

Thanks in advance for your help.