# Error: no HOME environment variable

**URL:** <https://discourse.openondemand.org/t/error-no-home-environment-variable/1816>\
**Category:** Get Help\
**Tags:** ondemand2, question\
**Created:** [November 30, 2021, 8:00pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816 "2021-11-30T20:00:21Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [November 30, 2021, 8:00pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/1 "2021-11-30T20:00:22Z")

</div>

Greetings,

In my ondemand installation i keep getting this error. I tried sourcing the ~/.bashrc in the script wrapper under batch\_connect and no go. Where else is the HOME environment set in the setup that i could be missing?

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.

---

<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:** [December 1, 2021, 2:55pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/2 "2021-12-01T14:55:09Z")

</div>

Hi and welcome!

I wonder if you can just force HOME to be set? Does your `~/.bashrc` load `/etc/profile`? I think maybe you need to source the global files that _then_ source your own. Maybe HOME is being set in those global etc files.

---

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [December 1, 2021, 8:54pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/3 "2021-12-01T20:54:54Z")

</div>

Greetings,

Have a separate issue now that’s making is hard for me to test. Every time i change my config in clusters.d it doesn’t seem to change on the app even after restarting the service. Is there a way to tell it to explicitly reload the config I updated in clusters.d?

---

<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:** [December 1, 2021, 9:01pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/4 "2021-12-01T21:01:39Z")

</div>

No we cache all those files at startup so you’ll have to bounce your PUN every time you make a change.

---

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [December 1, 2021, 11:56pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/5 "2021-12-01T23:56:35Z")

</div>

Ok gotcha. Seems I have another separate issue and can’t see where this environment is being set. It’s not in /etc/ood/config/hook.env but getting this when i reboot the pun for my username:

environment name contains a equal : {:OOD\_JOB\_NAME\_ILLEGAL\_CHARS=\>"/"}

Is there a system cache for it i need to delete? I deleted all the tmp files for the pun.

---

<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:** [December 2, 2021, 12:53am UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/6 "2021-12-02T00:53:27Z")

</div>

Can you send a screen shot? My suspicion is that your scheduler is complaining about environment variables when we submit

`/etc/ood/config/hook.env` only applies to the environment of the hook itself. A PUN itself on the OnDemand instance is started with very little in the way of an environment, but that’s beside the point anyhow. Your issue seems to be on the compute node during the jobs execution. This has nothing to do with the environment in the PUN, your scheduler is responsible for setting up the job’s execution environment.

What scheduler are you using?

---

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [December 2, 2021, 1:17am UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/7 "2021-12-02T01:17:39Z")

</div>

Sure, here’s what i get when i log in. It’s before i try grabbing a compute node right when i log in.

We’re using slurm.

![Screen Shot 2021-12-01 at 7.13.39 PM](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/8f2b7bd80b163dd78197255738781f8428af4de1.png)

---

<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:** [December 2, 2021, 3:17pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/8 "2021-12-02T15:17:59Z")

</div>

Um… OK. Not sure how that happened. Let’s do a spot check on your configuration, something must be upsetting it.

Did you set that env variable `OOD_JOB_NAME_ILLEGAL_CHARS`? I think I can replicate

```ruby
2.7.1 :016 > env = {'LASDF=' => 'sdflsdfn'}
2.7.1 :017 > Open3.capture3(env, 'ls')

```

It gives this error.

```auto
ArgumentError (environment name contains a equal : LASDF=)

```

There could be some bug here that you’ve uncovered, though how this is happening I don’t quite know. I’ll have to see what you’re trying to configure.

Let me know about any `/etc/ood` environment modifications you’re trying.

---

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [December 2, 2021, 3:35pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/9 "2021-12-02T15:35:02Z")

</div>

Very early when i was setting this up, i put OOD\_JOB\_NAME\_ILLEGAL\_CHARS="/" in the /etc/ood/config/hook.env file but removed when i realized it didn’t need to be there. Now the only place that value is set is in /etc/ood/config/nginx\_stage.yml. So can’t see where it’s coming from. When it generates the config for the pun /var/lib/ondemand-nginx/config/puns/user.conf

It reappears in the file every time i bounce the pun, not sure how it keeps getting there:

env USER;

env LOGNAME;

env ONDEMAND\_VERSION;

env ONDEMAND\_PORTAL;

env ONDEMAND\_TITLE;

env SECRET\_KEY\_BASE;

env NGINX\_FILE\_UPLOAD\_MAX;

env OOD\_DASHBOARD\_TITLE;

env OOD\_PORTAL;

env OOD\_DEV\_APPS\_ROOT;

env OOD\_FILES\_URL;

env OOD\_EDITOR\_URL;

env RAILS\_LOG\_TO\_STDOUT;

env {:OOD\_JOB\_NAME\_ILLEGAL\_CHARS=\>"/"};

env PATH;

env LD\_LIBRARY\_PATH;

env X\_SCLS;

env MANPATH;

env PCP\_DIR;

env PERL5LIB;

env PKG\_CONFIG\_PATH;

env PYTHONPATH;

env XDG\_DATA\_DIRS;

env SCLS;

env RUBYLIB;

---

<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:** [December 2, 2021, 3:49pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/10 "2021-12-02T15:49:17Z")

</div>

> [@mandorodriguez](#):
>
> Now the only place that value is set is in /etc/ood/config/nginx\_stage.yml. So can’t see where it’s coming from.

If it’s set in `nginx_stage.yml` then it’s coming from `nginx_stage.yml`. It should be set like this. Can you share _how_ you’re setting it?

```yaml
pun_custom_env:
  OOD_JOB_NAME_ILLEGAL_CHARS: "/"

```

---

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [December 2, 2021, 3:52pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/11 "2021-12-02T15:52:10Z")

</div>

Yes, it’s in there like this.

```auto
pun_custom_env:
  - OOD_JOB_NAME_ILLEGAL_CHARS: "/"

```

Edit: yep looks like that dash i must have added was doing it. Removed it and i can log in again.

---

<div class="post-metadata">

**Author:** ![mandorodriguez](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mandorodriguez/32/909_2.png) [@mandorodriguez](https://discourse.openondemand.org/u/mandorodriguez)\
**Post date:** [December 2, 2021, 4:07pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/12 "2021-12-02T16:07:13Z")

</div>

Well progress. Turned out $HOME wasn’t in the regular /etc/profile and since we did a lot of custom modifications for our environment i had to make a second file /etc/profile-portal that gets sourced for batch\_connect in the script wrapper:

```auto
  batch_connect:
    basic:
      script_wrapper: |
        #!/bin/bash
        set +o posix
        source /etc/profile-portal
        module purge
        %s
      set_host: "host=$(hostname -A | awk '{print $1}')"
    vnc:
      script_wrapper: |
        #!/bin/bash
        set +o posix
        source /etc/profile-portal
        module purge
        export PATH="/opt/TurboVNC/bin:$PATH"
        export WEBSOCKIFY_CMD="/apps/websockify/0.10.0/run"
        %s
      set_host: "host=$(hostname -A | awk '{print $1}')"

```

Now getting this so if there’s a separate topic that addressed this i can look at it or start a new topic.

 ![Screen Shot 2021-12-02 at 10.02.23 AM](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/0c8178bb47a41aff35af8f7b2f8854a94e1a6ffb.png)

---

<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:** [December 2, 2021, 4:12pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/13 "2021-12-02T16:12:09Z")

</div>

Could be! Can’t quite tell what’s going on here, but yea I’d say open a new topic is the best bet.

---

<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:** [May 31, 2022, 4:12pm UTC](https://discourse.openondemand.org/t/error-no-home-environment-variable/1816/14 "2022-05-31T16:12:58Z")

</div>

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