Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle missing $HOME / homedir() variable gracefully #15884

Closed
xiuliren opened this issue Apr 15, 2016 · 7 comments
Closed

handle missing $HOME / homedir() variable gracefully #15884

xiuliren opened this issue Apr 15, 2016 · 7 comments

Comments

@xiuliren
Copy link

Ubuntu 14.04, julia 0.4.5
I have a julia script, when I run it in a running aws instance, it works.
but when I tried to run it using user_data, which means running the script after system initialization, it failed.

I got the following output in /var/log/cloud-init-output.log. It seems that it is a problem of julia. Any help will be appreciated.

Base.InitError(mod=:Base, error=Base.KeyError(key="HOME"))
rec_backtrace at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
jl_throw at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
unknown function (ip: 0x7f0e54b75eca)
init_load_path at ./client.jl:302
__init__ at ./sysimg.jl:308
unknown function (ip: 0x7f0e54c04bb9)
jl_apply_generic at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
jl_module_run_initializer at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
unknown function (ip: 0x7f0e578d4713)
unknown function (ip: 0x7f0e578ccf2c)
julia_init at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
unknown function (ip: 0x4016d3)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x401725)
unknown function (ip: (nil))
2016-04-15 20:36:20,478 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
2016-04-15 20:36:20,480 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2016-04-15 20:36:20,480 - util.py[WARNING]: Running scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/dist-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Cloud-init v. 0.7.5 finished at Fri, 15 Apr 2016 20:36:20 +0000. Datasource DataSourceEc2.  Up 68.38 seconds
@tkelman
Copy link
Contributor

tkelman commented Apr 15, 2016

The system doesn't have the environment variable HOME set. Either we could try to find everywhere in the codebase that references ENV["HOME"] and try to make it degrade more gracefully if !haskey(ENV, "HOME"), or for now as a workaround you could set HOME to something.

@xiuliren
Copy link
Author

Tks, export HOME=/root works.

@vtjnash vtjnash reopened this Apr 17, 2016
@vtjnash vtjnash changed the title aws run instance with user_data handle missing $HOME / homedir() variable gracefully Apr 17, 2016
@davidanthoff
Copy link
Contributor

davidanthoff commented Jul 6, 2016

I just ran into this. I believe there is only one place in the whole julia code base that references ENV["HOME"] here (there is also a Windows specific code like this, but it seems more robust already). So adding a graceful fallback there might be enough?

There are also some tests that seem to use ENV["HOME"]. But searching the whole julia codebase for "HOME" just returned 5 hits in total...

@tkelman
Copy link
Contributor

tkelman commented Jul 7, 2016

The newer libuv we're now on should have a function we can use for this.

@grero
Copy link

grero commented Sep 14, 2016

I just ran into this as well while trying to launch htcondor jobs on Mac OS X 10.9.5.

julia> versioninfo()
Julia Version 0.5.0-rc4+0
Commit 9c76c3e (2016-09-09 01:43 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Xeon(R) CPU           X5472  @ 3.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, penny)

julia> Pkg.status()
1 required packages:
 - ClusterManagers               0.1.0

@NickMcNutt
Copy link

I also have this issue running Julia in some Docker containers (for instance phusion:baseimage-docker) since $HOME isn't set by default.

@tkelman
Copy link
Contributor

tkelman commented Apr 13, 2017

I think this was fixed on master by #19636

@tkelman tkelman closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants