Missing Home Directory Error

I don’t think that will work.

I’ve created this ticket to enable this use case becuase I don’t think we can handle this out of the box.

I can give you directions to hack this file, but it would be overwritten when you upgrade.

Since it may be your only choice, I’ll try to work something up as an example for you now.

Hacking the file is just fine for now. Thank you! I am not sure what changed as this did work two weeks in testing but we did reboot since then so probably some config was reloaded. We are using CAS too if that makes any difference but I do not think it does?


First I’m going to say I would no longer advise doing this. After spending a couple of hours on this I can get somethings to work and somethings not. The HOME environment variable does not seem to stick, I don’t know how to set it and keep it set forever. I can set it, but sure enough, it comes back to the original, so I’m not sure how to persist it.

I’d implore you instead to correct your LDAP. Indeed I don’t know how far we’ll get on the Github issue I’ve created given the pervasive nature of this variable.

Here are the changes you can make in these commits. I would first back up every file that you’re going to modify. Note this is on my fork, not the official repo.


I would copy the rb files from the Github branch source to the destinations above. Then manually add the config entry to the yml (you don’t need the comments).

Again, this is going to fail a whole bunch of areas where the home is just not set correctly. Sometimes it may just be a pain to navigate back to somewhere else or sometimes it may cause failure, but in either case your customers are not going to be very happy.

Hi John,

Thanks again for the help. Unfortunately, I cannot update Active Directory field with the home directory. We are mandated to use the Universities Central AD service for authentication and since numerous groups utilize AD, I can’t change the home directory location as it would affect other systems. I like the options mentioned in the support ticket you opened. Any chance those would be implemented?

Lastly, is there some debug mode I can turn on to see what home directory it actually thinks the user has set? I want to be sure it is trying to pull it from Active Directory.



@negregg would you log into the web host running OnDemand and run this command:

scl enable ondemand -- ruby -e "require 'etc'; puts [ENV['HOME'], Dir.home, Dir.home(ENV['USER']), File.expand_path('~'), Etc.getpwnam(ENV['USER']).dir]" 

Are any of the lines the correct home directory?

Surprisingly they are all ok … see following:

scl enable ondemand – ruby -e “require ‘etc’; puts [ENV[‘HOME’], Dir.home, Dir.home(ENV[‘USER’]), File.expand_path(’~’), Etc.getpwnam(ENV[‘USER’]).dir]”

Just to give you a quicker/easier change, I’ve found I can get the same results as that branch with this approach.

Just create an /etc/ood/profile file and override your HOME variable. No need to modify any source files. This will have the same affect and it is much simpler and easier to maintain.


@johrstrom Thanks! However, this did not fix my issue. I almost wonder if there is some other problem I am hitting? As the command @efranz sent me shows all the possible home directory locations being returned correctly and the /etc/ood/profile update did not seem to fix the issue. Is there a way to trace what is going on with OOD when the page is loading?


I have an update for you that may work now. I’ve figured out it was Passenger that wasn’t passing $HOME down to it’s sub processes’ and found the option to pass it.

Copy all the files changed in these commits. to these locations (backing up the original files as you go!!!)

  • /opt/ood/nginx_stage/lib/nginx_stage.rb
  • /opt/ood/nginx_stage/lib/nginx_stage/configuration.rb
  • /opt/ood/nginx_stage/lib/nginx_stage/user.rb
  • /etc/ood/config/nginx_stage.yml
  • /opt/ood/nginx_stage/lib/nginx_stage/nginx_stage/templates/pun.conf.erb

Here’s a little info just for posterity. One can see that the watchdog as the right HOME but core doesn’t.

# output from ps -elf
4 S ood        710     1  3  80   0 - 91569 -      20:17 ?        00:00:00 Passenger watchdog
0 S ood        713   710  4  80   0 - 372460 -     20:17 ?        00:00:00 Passenger core

[root@localhost /]# cat /proc/710/environ | tr '\0' '\n' | grep HOME
[root@localhost /]# cat /proc/713/environ | tr '\0' '\n' | grep HOME

@johrstrom thanks for the help. I believe I copied all the appropriate files into place but still having same issue. Some things to note:

  • templates/pun.conf.erb did not exist so i created the directory and file
  • After not working, I did edit ood_portal.yml and add user_home_dir: '/users/%{user}' but it did not fix the issue either.

Note, the environment var looks to be ok based on your ps example:

[root@lrp-trcvm001 config]#  cat /proc/115988/environ | tr '\0' '\n'|grep -i home
[root@lrp-trcvm001 config]#  cat /proc/115982/environ | tr '\0' '\n'|grep -i home


Sorry, that file path given was way off. It’s /opt/ood/nginx_stage/templates/pun.conf.erb is correct path. It should already exist.

It’s not ood_portal.yml you need to add it it it’s nginx_stage.yml.

Note that after you replace everything you’ll probably have to bounce httpd24 and your own PUN web server. That could be all you need though I’d double check the file list just to be sure.

Your ENV output there is good! But the first and initial hurdle seems to be this Etc business.

Typo on my end … i meant to say I edited nginx_stage.yml. So after placing pun.conf.erb in the right location I am getting this:

Error -- nginx: [emerg] invalid number of arguments in "passenger_env_var" directive in /var/lib/ondemand-nginx/config/puns/negregg.conf:58

Sorry it needs a ; on the end.

passenger_env_var HOME '/users/<%= user %>';

No problem. So that error is gone away not but unfortunately back to:

Home directory not found
Your home directory appears to be missing. The home directory mount may be unavailable, or your home directory may need to still be created. Please contact support for help and attempt to restart your web server by clicking below when the problem has been fixed.

Are you sure when you checked out that git repo you switched to that branch? As a sanity check you can do a quick diff on one of the files you swapped and backed up.

git clone https://github.com/johrstrom/ondemand.git
cd ondemand
git checkout override-home-dir

Yup … see below md5sums to verify (note: /etc/ood/config/nginx_stage.yml not listed due to modification which makes the md5sum mismatch).

4e66710d145efbdfbf7cdb82172aec79 lib/nginx_stage.rb
4e66710d145efbdfbf7cdb82172aec79 /opt/ood/nginx_stage/lib/nginx_stage.rb
5de9bf9aa46ff0d60b3913baaeb31443 lib/nginx_stage/configuration.rb
5de9bf9aa46ff0d60b3913baaeb31443 /opt/ood/nginx_stage/lib/nginx_stage/configuration.rb
ecec30df5c28b0da579da0f08b612857 lib/nginx_stage/user.rb
ecec30df5c28b0da579da0f08b612857 /opt/ood/nginx_stage/lib/nginx_stage/user.rb
713fe9730e91e9b7a0ef2039cfc81846 templates/pun.conf.erb
713fe9730e91e9b7a0ef2039cfc81846 /opt/ood/nginx_stage/templates/pun.conf.er

That is a bummer. I’m able to replicate the issue and the fix locally, so there must be something more to this. I cannot replicate LDAP locally so I must be missing something there.

Here’s where you can circumvent showing that page. That was put in as a sort of safety measure because who knows what sort of side affects a missing home directory may have.


    def missing_home_directory?
      # comment this bit out and just return false
      # ! Dir.exist?(user.dir)

So I commented that out and it is working just fine. When I log in, I am in the proper home directory. I assume I am hitting a bug somewhere?


I’m not 100% sure of where it’ll come up again, but I’d bet it will. It may not! But it probably will. We don’t seem to have one consistent way of getting the home directory and we try to access it a lot.

Good to hear it’s working now. Watch that Github ticket to see when we actually fix the issue, sorry we had to hack your system and leave it in a “well it’s probably buggy” state.

Let us know if something more comes up.

Thanks @johrstrom! I am tempted to back out all the changes we made and only comment out missing_home_directory to see if it works. I speculate it will.

The weird thing is this was working just fine a few weeks ago with no changes.

Thanks again for all the help!