# Troubleshooting Interactive Desktops

**URL:** <https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020>\
**Category:** Get Help\
**Tags:** question\
**Created:** [October 16, 2023, 3:18am UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020 "2023-10-16T03:18:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![garthand](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/garthand/32/1918_2.png) [@garthand](https://discourse.openondemand.org/u/garthand)\
**Post date:** [October 16, 2023, 3:18am UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/1 "2023-10-16T03:18:36Z")

</div>

When I try to launch an interactive desktop (using Slurm as our scheduler), the job fails immediately with this as the stderr:

/var/spool/slurmd/job50924/slurm\_script: line 3: module: command not found  
/var/spool/slurmd/job50924/slurm\_script: line 7: //.bashrc: No such file or directory  
Setting VNC password…  
Error: no HOME environment variable  
Starting VNC server…  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
vncserver: The HOME environment variable is not set.  
Cleaning up…  
vncserver: The HOME environment variable is not set.

The node’s slurmd.log also reports:

error: \_get\_user\_env: Unable to get user’s local environment, running only with passed environment

If I’m interpreting this correctly, both the module command not being found and $HOME not being set appear to be due to a failure to export the user’s local environment. I tried changing my desktop’s submit.yml.erb to:

* * *

script:  
copy\_environment: true

but no dice. It may be worth mentioning that we’re using Centrify to manage our users; they’re not locally in /etc/passwd.

Do I need to do something extra to make sure environment variables are being exported as expected?

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [October 16, 2023, 5:26pm UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/2 "2023-10-16T17:26:19Z")

</div>

Hello and welcome!

Sorry for the troubles. Could you provide the OOD version and OS you are using?

Where is the `submit.yml` file actually sitting in the directory structure? Are you able to share the whole file (sanitized) and also post in using formatting, as right now I can’t tell if the `script` stanza has `copy_environment` at the right level.

---

<div class="post-metadata">

**Author:** ![garthand](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/garthand/32/1918_2.png) [@garthand](https://discourse.openondemand.org/u/garthand)\
**Post date:** [October 16, 2023, 6:06pm UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/3 "2023-10-16T18:06:40Z")

</div>

Sure thing! I’m running OOD 3.0.3 and RHEL 8.7.

The full path to the file is: /etc/ood/config/apps/bc\_desktop/submit/submit.yml.erb

This is what I currently have:

```auto
---
script:
  copy_environment: true
  native:
    - "-N"
    - "<%= bc_num_slots.blank? ? 1 : bc_num_slots.to_i %>"

```

Thank you for taking a look!

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [October 16, 2023, 7:29pm UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/4 "2023-10-16T19:29:21Z")

</div>

Have you already worked through the docs for setting up the interactive apps here;  
[https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/setup/modify-cluster-configuration.html](https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/setup/modify-cluster-configuration.html)

I think you’ll see a better example there using `script_wrapper` to `export` various environment variables, which might be what you need for the `HOME` and then you can use something like:

```auto
---
batch_connect:
  before_script: |
    # Export the module function if it exists
    [[$(type -t module) == "function"]] && export -f module

```

To get the `module` command I believe.

---

<div class="post-metadata">

**Author:** ![garthand](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/garthand/32/1918_2.png) [@garthand](https://discourse.openondemand.org/u/garthand)\
**Post date:** [October 16, 2023, 8:34pm UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/5 "2023-10-16T20:34:42Z")

</div>

Thank you! I did work through that section but I missed the before\_script option.

Would it be correct then to say that we need to manually export everything from /etc/profile.d/ via before\_script, and then at the end source the user’s .bashrc (or equivalent) to re-create the $PATH they would normally have via ssh?

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [October 17, 2023, 3:41pm UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/6 "2023-10-17T15:41:55Z")

</div>

I don’t know if you need to export everything. All I can say to to this is that you can use that key to set some script commands to execute before your main `script.sh`, or you can even define an entire `before.sh` file in the same directory of the `script.sh` of an app to run and do `exports` or setup the environment however you need before the job runs.

Using the `before.sh` pattern can be seen in more extensive apps like Jupyter or RStudio:

> <https://github.com/OSC/bc_osc_jupyter/blob/master/template/before.sh.erb>

---

<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:** [April 14, 2024, 3:42pm UTC](https://discourse.openondemand.org/t/troubleshooting-interactive-desktops/3020/7 "2024-04-14T15:42:04Z")

</div>

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