Troubleshooting Interactive Desktops

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?

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.

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:

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

Thank you for taking a look!

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

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:

---
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.

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?

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:

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