# Problems with interactive Matlab app window

**URL:** <https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476>\
**Category:** Get Help\
**Created:** [February 11, 2023, 11:14pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476 "2023-02-11T23:14:08Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 11, 2023, 11:14pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/1 "2023-02-11T23:14:09Z")

</div>

Hello, I’m having trouble getting the expected behavior with the window in a Matlab interactive app. Any help or ideas would be greatly appreciated!

My problem appears similar to the issue described in [Matlab window problem](https://discourse.openondemand.org/t/matlab-window-problem/2294): the standard window features don’t work, i.e. the window won’t resize, min/max/close buttons are missing. However, I’m seeing different errors in the log.

I’m using a simplified version of OSC’s **script.sh.erb** from the [OSC/bc\_osc\_matlab GitHub repo](https://github.com/OSC/bc_osc_matlab/blob/master/template/script.sh.erb):

```auto
#!/usr/bin/env bash

# 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)"
  set -x
  xfwm4 --compositor=off --sm-client-disable
  xsetroot -solid "#D3D3D3"
  xfsettingsd --sm-client-disable
  xfce4-panel --sm-client-disable
) &

# Start MATLAB

# Load the required environment
module load matlab

# Launch MATLAB
module list
set -x
matlab -desktop

```

Here’s **output.log** :

```auto
Setting VNC password...
Starting VNC server...

Desktop 'TurboVNC: <hostname>:1 (<username>)' started on display <hostname>:1

Log file is vnc.log
Successfully started VNC server on <hostname>:5901...
Script starting...
Starting websocket server...
+ xfwm4 --compositor=off --sm-client-disable
Currently Loaded Modulefiles:
 1) matlab/R2020a  
+ matlab -desktop
WebSocket server settings:
  - Listen on :9882
  - No SSL/TLS support (no cert file)
  - Backgrounding (daemon)
Scanning VNC log file for user authentications...
Generating connection YAML file...
+ xsetroot -solid '#D3D3D3'
+ xfsettingsd --sm-client-disable
xfsettingsd: Could not connect: No such file or directory.

(xfsettingsd:718476): xfsettingsd-ERROR **: 10:43:40.190: Failed to connect to the dbus session bus.
/home/<username>/ondemand/data/sys/dashboard/batch_connect/sys/matlab/output/b2b33142-b9b3-409f-85e1-5a0aeb6b8dae/script.sh: line 22: 718476 Trace/breakpoint trap (core dumped) xfsettingsd --sm-client-disable
+ xfce4-panel --sm-client-disable

(xfce4-panel:718489): xfce4-panel-WARNING **: 10:43:40.376: Failed to connect to the D-BUS session bus: Could not connect: No such file or directory

(xfce4-panel:718489): xfce4-panel-CRITICAL **: 10:43:40.377: Name org.xfce.Panel lost on the message dbus, exiting.
xfce4-panel: There is already a running instance

MATLAB is selecting SOFTWARE OPENGL rendering.
Failed to create secure directory (/run/user/<uid>/pulse): No such file or directory
Setting VNC password...
Generating connection YAML file...

```

Can I get a dummy check from someone who has a working setup? Did I miss something?

Here’s my setup:  
OS: latest RHEL 8.7, with regular updates  
Slurm 20.11  
Xfce 4.16 installed from EPEL 8 repo  
OOD 2.0.31

Thanks for any assistance you can provide!

---

<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:** [February 13, 2023, 4:51pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/2 "2023-02-13T16:51:03Z")

</div>

Hi Daniel.

Thanks for your post. Just wanted to let you know that I am looking into this.

Thanks,  
-gerald

---

<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:** [February 13, 2023, 5:25pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/3 "2023-02-13T17:25:39Z")

</div>

Hi Daniel.

Can you please start your MatLab job and send me the View Only/Shareable link?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/7/7eecea0968ddf1e05ea054d255f7b6d3635abc84.png)

I want to see if you & I are seeing the same thing.

Thanks,  
-gerald

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 13, 2023, 5:56pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/4 "2023-02-13T17:56:01Z")

</div>

Thanks so much Gerald!

Unfortunately, the link won’t work, I’m on a restricted network. But here’s a screenshot of what I see (blank this time, but other times I can see everything but no window control buttons):

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/5/52a7b8d357eb406e453a7005905d2ba24ca83e52.png)

Also, another data point: through testing, I’ve found that if I have a separate SSH session on the compute node going at the same time, launching an interactive Matlab session works as expected, the window is responsive and there aren’t any errors in the log.

Here’s a screenshot when that separate SSH session is active

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

Here’s that **output.log** :

```auto
Setting VNC password...
Starting VNC server...

Desktop 'TurboVNC: <hostname>:1 (<username>)' started on display <hostname>:1

Log file is vnc.log
Successfully started VNC server on <hostname>:5901...
Script starting...
Starting websocket server...
+ xfwm4 --compositor=off --sm-client-disable
Currently Loaded Modulefiles:
 1) matlab/R2020a  
+ matlab -desktop
WebSocket server settings:
  - Listen on :9183
  - 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.
Setting VNC password...
Generating connection YAML file...

```

---

<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:** [February 13, 2023, 6:30pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/5 "2023-02-13T18:30:05Z")

</div>

Hi Daniel.

Here’s some screen captures from mine using the script that you provided.

The original startup.

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

I click the “RESTORE” control button (  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/9/9ec78251ea9fa7d7d32a7c116622c9451b8f0626.png)  
) on the Matlab window and get the following.

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

You will notice all control buttons are missing. However, they aren’t missing, they are actually off screen to the right. If I drag the window to the left, then the control buttons are now visible.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/9/980929d1818138a23e750323728b19730d37b603.jpeg)

I would like to propose that you join our Open office Hours tomorrow at 11:15 Eastern. There will be more folks on the call, and we can also have you share your screen so we can help trouble-shoot. The meeting information is:

Topic: Open OnDemand Open Office Hours

Time: This is a recurring meeting Meet anytime

Join Zoom Meeting

> **[Join our Cloud HD Video Meeting](https://osu.zoom.us/j/96298568321?pwd=a2hIRElHNCtPalFrMnREUC9YaDlxdz09)**
>
> Zoom is the leader in modern enterprise video communications, with an easy, reliable cloud platform for video and audio conferencing, chat, and webinars across mobile, desktop, and room systems. Zoom Rooms is the original software-based conference...

Meeting ID: 962 9856 8321

Password: 424991

One tap mobile

+16513728299,96298568321#,0#,424991# US (Minnesota)

+13017158592,96298568321#,0#,424991# US (Washington DC)

Dial by your location

+1 651 372 8299 US (Minnesota)

+1 301 715 8592 US (Washington DC)

+1 312 626 6799 US (Chicago)

+1 646 876 9923 US (New York)

+1 669 900 6833 US (San Jose)

+1 253 215 8782 US (Tacoma)

+1 346 248 7799 US (Houston)

+1 408 638 0968 US (San Jose)

Meeting ID: 962 9856 8321

Password: 424991

Find your local number: [Zoom International Dial-in Numbers - Zoom](https://osu.zoom.us/u/acdBffcaQl)

Join by SIP

[96298568321@zoomcrc.com](mailto:96298568321@zoomcrc.com)

Join by H.323

162.255.37.11 (US West)

162.255.36.11 (US East)

115.114.131.7 (India Mumbai)

115.114.115.7 (India Hyderabad)

213.19.144.110 (Amsterdam Netherlands)

213.244.140.110 (Germany)

103.122.166.55 (Australia Sydney)

103.122.167.55 (Australia Melbourne)

64.211.144.160 (Brazil)

69.174.57.160 (Canada Toronto)

65.39.152.160 (Canada Vancouver)

207.226.132.110 (Japan Tokyo)

149.137.24.110 (Japan Osaka)

Meeting ID: 962 9856 8321

Password: 424991

* * *

The Ohio State University

* * *

Please direct question about this meeting to the meeting organizer.

CarmenZoom is a service provided by the Office of Technology and Digital Innovation (IT.osu.edu).

go.osu.edu/SystemStatus

614-688-4357 (HELP)

[CarmenZoom@osu.edu](mailto:CarmenZoom@osu.edu)

If you have a disability and have trouble accessing this content, please call the Accessibility Help Line 614-292-5000.

Privacy: go.osu.edu/privacy

Digital Accessibility: accessibility.osu.edu

Nondiscrimination Notice (PDF): go.osu.edu/NonDiscrimination-Notice

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 13, 2023, 7:10pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/6 "2023-02-13T19:10:51Z")

</div>

While you can totally come to office hours - I’d try setting your `XDG_RUNTIME_DIR` to something within the $TMDIR. We’ve had similar issues with Slurm and XDG settings.

> [@djareval](#):
>
> ```auto
> xfsettingsd: Could not connect: No such file or directory.
> 
> (xfsettingsd:718476): xfsettingsd-ERROR **: 10:43:40.190: Failed to connect to the dbus session bus.
> /home/<username>/ondemand/data/sys/dashboard/batch_connect/sys/matlab/output/b2b33142-b9b3-409f-85e1-5a0aeb6b8dae/script.sh: line 22: 718476 Trace/breakpoint trap (core dumped) xfsettingsd --sm-client-disable
> + xfce4-panel --sm-client-disable
> 
> ```

> [@djareval](#):
>
> `Failed to create secure directory (/run/user/<uid>/pulse): No such file or directory`

These 2 messages are very important - you’re core dumping and you can’t use `/run/user/$UID` during the job.

You can set export `XDG_RUNTIME_DIR` for the entire cluster in the same place you may have set `script_wrapper` in your `cluster.d` file.

If you haven’t set a `script_wrapper` you can see this example here for the same.

[https://osc.github.io/ood-documentation/latest/installation/cluster-config-schema.html?highlight=module%20restore](https://osc.github.io/ood-documentation/latest/installation/cluster-config-schema.html?highlight=module%20restore)

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 14, 2023, 4:37pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/7 "2023-02-14T16:37:43Z")

</div>

Here’s the cluster file:

```auto
---
    v2:
      metadata:
        title: "<title>"
      login:
        host: "<FQDN>"
      job:
        adapter: "slurm"
        bin: "/usr/bin"
        conf: "/etc/slurm/slurm.conf"
      batch_connect:
        basic:
          script_wrapper: |
            module purge
            %s
        vnc:
          script_wrapper: |
            module purge
            export PATH="/opt/TurboVNC/bin/:$PATH"
            export WEBSOCKIFY_CMD="/usr/bin/websockify"
            %s
          min_port: 9000
          max_port: 9999

```

Here’s where I tried redefining the runtime directory variable in **script.sh.erb** (right at the top):

```auto
#!/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)"
  set -x
  xfwm4 --compositor=off --sm-client-disable
  xsetroot -solid "#D3D3D3"
  xfsettingsd --sm-client-disable
  xfce4-panel --sm-client-disable
) &

#
# Start MATLAB
#

# Load the required environment
module load matlab

# Launch MATLAB
module list
set -x
matlab -desktop

```

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 14, 2023, 4:41pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/8 "2023-02-14T16:41:57Z")

</div>

Here try setting it in the `before_script` so that it’ll try to set it before `vncserver` boots up.

```yaml
---
    v2:
      metadata:
        title: "<title>"
      login:
        host: "<FQDN>"
      job:
        adapter: "slurm"
        bin: "/usr/bin"
        conf: "/etc/slurm/slurm.conf"
      batch_connect:
        basic:
          script_wrapper: |
            module purge
            %s
        vnc:
          before_script: |
            # Export the module function if it exists
            [[$(type -t module) == "function"]] && export -f module

            # Slurm doesn't like /var/run/$(id -u)
            export XDG_RUNTIME_DIR="$TMPDIR/xdg_runtime"
          script_wrapper: |
            module purge
            export PATH="/opt/TurboVNC/bin/:$PATH"
            export WEBSOCKIFY_CMD="/usr/bin/websockify"
            %s
          min_port: 9000
          max_port: 9999

```

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 16, 2023, 1:40am UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/9 "2023-02-16T01:40:07Z")

</div>

Unfortunately, it’s still not working, though an `echo` in **script.sh.erb** shows the variable is being set as we want:

```bash
... <truncated> ...
# Launch MATLAB
module list
set -x
echo $XDG_RUNTIME_DIR
matlab -desktop

```

Here’s **output.log** :

```plaintext
Setting VNC password...
Starting VNC server...

Desktop 'TurboVNC: <hostname>:1 (<username>)' started on display <hostname>:1

Log file is vnc.log
Successfully started VNC server on <hostname>:5901...
Script starting...
Starting websocket server...
+ xfwm4 --compositor=off --sm-client-disable
Currently Loaded Modulefiles:
 1) matlab/R2020a  
+ echo /tmp/xdg_runtime
/tmp/xdg_runtime
+ matlab -desktop
WebSocket server settings:
  - Listen on :9734
  - 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.
+ xsetroot -solid '#D3D3D3'
+ xfsettingsd --sm-client-disable
xfsettingsd: Could not connect: No such file or directory.

(xfsettingsd:907982): xfsettingsd-ERROR **: 15:24:16.079: Failed to connect to the dbus session bus.
/home/<username>/ondemand/data/sys/dashboard/batch_connect/sys/matlab/output/68ad510a-ee1e-476d-a8ce-41e1638c3424/script.sh: line 22: 907982 Trace/breakpoint trap (core dumped) xfsettingsd --sm-client-disable
+ xfce4-panel --sm-client-disable

(xfce4-panel:907999): xfce4-panel-WARNING **: 15:24:16.382: Failed to connect to the D-BUS session bus: Could not connect: No such file or directory

(xfce4-panel:907999): xfce4-panel-CRITICAL **: 15:24:16.383: Name org.xfce.Panel lost on the message dbus, exiting.
xfce4-panel: There is already a running instance

Setting VNC password...
Generating connection YAML file...

```

I think the issue here may be that the variable isn’t set “early” enough. Though I’m not quite sure where to set it. I tried **~/.pam\_environment** and **/etc/environment** based on the `pam_env` man page, but those didn’t affect any change with the slurm submissions, I only noticed the updated variable if I directly logged in with SSH.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 16, 2023, 2:36pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/10 "2023-02-16T14:36:22Z")

</div>

OK, maybe try to export it in the `script_wrapper`. When you check `job_script_content` (the script we submit to slurm) this will be one of the first things it does.

```auto
---
    v2:
      metadata:
        title: "<title>"
      login:
        host: "<FQDN>"
      job:
        adapter: "slurm"
        bin: "/usr/bin"
        conf: "/etc/slurm/slurm.conf"
      batch_connect:
        basic:
          script_wrapper: |
            module purge
            %s
        vnc:
          script_wrapper: |
            module purge
            export PATH="/opt/TurboVNC/bin/:$PATH"
            export WEBSOCKIFY_CMD="/usr/bin/websockify"

            # Slurm doesn't like /var/run/$(id -u)
            export XDG_RUNTIME_DIR="$TMPDIR/xdg_runtime"
            %s
          min_port: 9000
          max_port: 9999

```

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 17, 2023, 6:47am UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/11 "2023-02-17T06:47:00Z")

</div>

Thanks for the help Jeff. It’s still not working, and I think the journal shows why - the login which triggers the user runtime directory (URD) creation occurs before any slurm script is actually run:

```plaintext
Feb 16 21:31:18 su[2121572]: (to <username>) root on none
Feb 16 21:31:18 systemd[1]: Created slice User Slice of UID <uid>.
Feb 16 21:31:18 systemd[1]: Starting User runtime directory /run/user/<uid>...
Feb 16 21:31:18 systemd[1]: Started User runtime directory /run/user/<uid>.
Feb 16 21:31:18 systemd[1]: Starting User Manager for UID <uid>...
Feb 16 21:31:18 systemd[2121576]: pam_unix(systemd-user:session): session opened for user <username> by (uid=0)
Feb 16 21:31:19 systemd[2121576]: Started Mark boot as successful after the user session has run 2 minutes.
Feb 16 21:31:19 systemd[2121576]: Reached target Paths.
Feb 16 21:31:19 systemd[2121576]: Reached target Timers.
Feb 16 21:31:19 systemd[2121576]: Listening on Sound System.
Feb 16 21:31:19 systemd[2121576]: Listening on Multimedia System.
Feb 16 21:31:19 systemd[2121576]: Starting D-Bus User Message Bus Socket.
Feb 16 21:31:19 systemd[2121576]: Listening on D-Bus User Message Bus Socket.
Feb 16 21:31:19 systemd[2121576]: Reached target Sockets.
Feb 16 21:31:19 systemd[2121576]: Reached target Basic System.
Feb 16 21:31:19 systemd[1]: Started User Manager for UID <uid>.
Feb 16 21:31:19 systemd[2121576]: Starting Sound Service...
Feb 16 21:31:19 systemd[1]: Started Session c23 of user <username>.
Feb 16 21:31:19 su[2121572]: pam_unix(su-l:session): session opened for user <username> by (uid=0)
Feb 16 21:31:19 su[2121572]: pam_unix(su-l:session): session closed for user <username>
Feb 16 21:31:19 systemd[1]: session-c23.scope: Succeeded.
Feb 16 21:31:20 slurmd[7631]: slurmd: Launching batch job 404 for UID <uid>
<... trucncated ...>
Feb 16 21:31:29 systemd[1]: Stopping User Manager for UID <uid>...
Feb 16 21:31:29 systemd[2121576]: Stopping D-Bus User Message Bus...
Feb 16 21:31:29 systemd[2121576]: Stopping Accessibility services bus...
Feb 16 21:31:29 systemd[2121576]: Stopped target Default.
Feb 16 21:31:29 systemd[2121576]: Stopping Sound Service...
Feb 16 21:31:29 systemd[2121576]: Stopped D-Bus User Message Bus.
Feb 16 21:31:29 systemd[2121576]: Stopped Accessibility services bus.
Feb 16 21:31:29 systemd[2121576]: Stopped Sound Service.
Feb 16 21:31:29 systemd[2121576]: Stopped target Basic System.
Feb 16 21:31:29 systemd[2121576]: Stopped target Sockets.
Feb 16 21:31:29 systemd[2121576]: Closed Multimedia System.
Feb 16 21:31:29 systemd[2121576]: Closed D-Bus User Message Bus Socket.
Feb 16 21:31:29 systemd[2121576]: Stopped target Paths.
Feb 16 21:31:29 systemd[2121576]: Stopped target Timers.
Feb 16 21:31:29 systemd[2121576]: Stopped Mark boot as successful after the user session has run 2 minutes.
Feb 16 21:31:29 systemd[2121576]: Closed Sound System.
Feb 16 21:31:29 systemd[2121576]: Reached target Shutdown.
Feb 16 21:31:29 systemd[2121576]: Started Exit the Session.
Feb 16 21:31:29 systemd[2121576]: Reached target Exit the Session.
Feb 16 21:31:29 systemd[1]: user@<uid>.service: Succeeded.
Feb 16 21:31:29 systemd[1]: Stopped User Manager for UID <uid>.
Feb 16 21:31:29 systemd[1]: Stopping User runtime directory /run/user/<uid>...
Feb 16 21:31:29 systemd[1]: run-user-<uid>.mount: Succeeded.
Feb 16 21:31:29 systemd[1]: user-runtime-dir@<uid>.service: Succeeded.
Feb 16 21:31:29 systemd[1]: Stopped User runtime directory /run/user/<uid>.
Feb 16 21:31:29 systemd[1]: Removed slice User Slice of UID <uid>

```

I’ve spent some time digging into how to modify `XDG_RUNTIME_DIR` as early as possible, trying **pam\_env** and **/etc/systemd/system.conf** , all with no luck. I can get verification in the logs that the variable gets updated, both before and after pam\_systemd actually creates the URD, but it doesn’t change it, it’s always /run/user/\<uid\>.

But taking a step back, I don’t think the URD location matters; xfwm4 is having problems because the URD gets deleted shortly after its creation, but deep diving through some man pages indicates that’s to be expected. At job submission, slurmd launches the job under the user’s UID by executing an `su`, triggering a user login session and resultant URD creation. But the actual job processes run under the slurmd service session, not a user session. So regardless of where the URD is, it’s going to be deleted after 10 seconds (a time limit controlled by `UserStopDelaySec` in logind.conf)

But that begs the question: how has anyone been able to get this working? The only solution I can see is to somehow keep the URD sticking around, either by setting a long `UserStopDelaySec` variable or by enabling user lingering (with `loginctl enable-linger`).

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 22, 2023, 8:30pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/12 "2023-02-22T20:30:45Z")

</div>

Hi Jeff and team,  
If you’re still interested in looking at this, I’d love to get your thoughts. If you’re available, I could set up a call over Microsoft Teams, which would allow me to share a screen and give you more visibility into what I’m seeing.  
Thanks again for any assistance!

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 22, 2023, 8:40pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/13 "2023-02-22T20:40:58Z")

</div>

Yes we can meet, send an invite to johrstrom@osc.edu.

I’d be interested in seeing more `journalctl` output.

I’m now wondering if it’s perhaps it’s because you’re in a cgroup when you’re in a Slurm job. When you shell in, I doubt you get the same cgroup settings (if any at all).

So I’m wondering if there’s a permission type issue here or similar. I guess I’d also want to look logs in `/var/log/audit/` if you have SELinux enabled.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 23, 2023, 9:18pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/14 "2023-02-23T21:18:22Z")

</div>

I had forgotten this; that our newest cluster is RHEL/8. We haven’t migrated any of our applications to it yet, and lo and behold - I can replicate the same exact error.

Not a similar error - it seems to be the exact same.

```auto
xfwm4: Unknown option --daemon.
Type "xfwm4 --help" for usage.
+ xsetroot -solid '#D3D3D3'
+ xfsettingsd --sm-client-disable
Killing Xvnc process ID 4155812
xfsettingsd: Error spawning command line “dbus-launch --autolaunch=543f64dd20ca40f69108531cad975036 --binary-syntax --close-stderr”: Child process exited with code 1.

(xfsettingsd:4155908): xfsettingsd-ERROR **: 16:14:54.568: Failed to connect to the dbus session bus.
/users/PZS0714/johrstrom/ondemand/data/sys/dashboard/batch_connect/dev/matlab/output/8a921b60-410d-40c1-a2c8-45e8ce0bac42/script.sh: line 25: 4155908 Trace/breakpoint trap (core dumped) xfsettingsd --sm-client-disable

```

So, given that I can replicate so easily - it seems that this is a common/shared issue with RHEL/8.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 24, 2023, 3:44pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/15 "2023-02-24T15:44:49Z")

</div>

I think I’ve made some progress on this. Try this `script.sh.erb`. You’ll note that we have to background a few things instead of the entire block. Along with some `sleep`s that are a bit hacky to be sure, but I’ve found that we need things to boot up properly before the next command is issued.

```auto
#!/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
xfwm4 --sm-client-disable &
sleep 5
xsetroot -solid "#D3D3D3"
xfsettingsd --daemon --sm-client-disable
xfce4-panel --sm-client-disable &

sleep 5

#
# Start MATLAB
#

# Load the required environment
module load matlab

# Launch MATLAB
module list
set -x
matlab -desktop

```

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [February 27, 2023, 2:26pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/16 "2023-02-27T14:26:13Z")

</div>

Jeff, thank you very much for your engagement on this!

Those edits didn’t work for me, but I was able to get a fix.

It had to do with the `dbus-launch` command you first identified on our call, when reviewing the **bc\_desktop/template/desktops/xfce.sh** script. I’m not sure what made me conclude it wasn’t working during the call, but it’s definitely working now.

Here’s my **submit.sh.erb** (the notable addition being `eval $(dbus-launch --sh-syntax`):

```bash
#!/usr/bin/env bash

# Clean the environment
module purge

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

# Launch Xfce Window Manager and Panel
#

(
  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 --daemon --sm-client-disable
  xfce4-panel --sm-client-disable
) &

#
# Start MATLAB
#

# Load the required environment
module load matlab

# Launch MATLAB
module list
set -x
matlab -desktop

```

I’m still a little hazy on the full picture, but the result that the Xfce components now have a dbus session interface running in the slurmd cgroup, rather than trying to use the short-lived connection in the user cgroup (`XDG_RUNTIME_DIR`). And the window control features work as expected!

---

<div class="post-metadata">

**Author:** ![djareval](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/djareval/32/1275_2.png) [@djareval](https://discourse.openondemand.org/u/djareval)\
**Post date:** [April 27, 2023, 5:33pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/17 "2023-04-27T17:33:43Z")

</div>

We recently had to revisit this due to a separate issue, and time had provided a little insight (I think!).  
To summarize, for future reference:

To get a working setup on RHEL 8 with Xfce 4.16.1 (from EPEL), two changes are needed from OSC’s baseline **script.sh.erb** :

1. A message bus for the various Xfce components has to be manually launched (`dbus-launch`)
2. The window manager `xfwm4` has to executed in the background; [the `--daemon` option is no longer valid](https://gitlab.xfce.org/xfce/xfwm4/-/commit/43e76c7bdfa6db6bf95f576723dc5e41cc15f59e)

Here’s the parenthesized block of Xfce commands we’re using with success:

```auto
# Launch Xfce Window Manager and Panel
#
(
  export XDG_CONFIG_HOME="<%= session.staged_root.join("config") %>"
  export XDG_DATA_HOME="<%= session.staged_root.join("share") %>"
  export XDG_CACHE_HOME="$(mktemp -d)"
  eval $(dbus-launch --sh-syntax)
  xfwm4 --compositor=off --sm-client-disable &
  xsetroot -solid "#D3D3D3"
  xfsettingsd --daemon --sm-client-disable
  xfce4-panel --sm-client-disable
) &

```

---

<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:** [October 24, 2023, 5:34pm UTC](https://discourse.openondemand.org/t/problems-with-interactive-matlab-app-window/2476/18 "2023-10-24T17:34:03Z")

</div>

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