Pkg.init() Segmentation Fault



I’ve been looking around the issues on Github and the discussion here and haven’t found a solution to my problem. A few things. I’m behind a corporate proxy and on ubuntu-16.04. I’ve downloaded the precompiled version of Julia 0.6.2 but get some weird behavior when trying to add packages or even run Pkg.init().

Using the julia executable:

julia> Pkg.init()
INFO: Initializing package repository /home/matthew/.julia/v0.6

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
_IO_new_file_fopen at /build/glibc-Cl5G7W/glibc-2.23/libio/fileops.c:260
__fopen_internal at /build/glibc-Cl5G7W/glibc-2.23/libio/iofopen.c:86
fopen64 at /lib/ (unknown line)
cd at ./file.jl:66
Allocations: 1055791 (Pool: 1054681; Big: 1110); GC: 0
[1]    15679 segmentation fault (core dumped)  ./julia

and the julia-debug executable

julia> Pkg.init()
INFO: Initializing package repository /home/matthew/.julia/v0.6
INFO: Cloning METADATA from
ERROR: SystemError: fchdir: Not a directory
 [1] #systemerror#44 at ./error.jl:64 [inlined]
 [2] systemerror(::Symbol, ::Bool) at ./error.jl:64
 [3] cd(::Base.Pkg.Dir.##8#10{String,String}, ::String) at ./file.jl:72
 [4] init(::String, ::String) at ./pkg/dir.jl:53
 [5] init() at ./pkg/pkg.jl:85

Because it isn’t throwing me errors about not being able to access the internet I don’t think it is my proxy settings (ENV[“HTTP_PROXY”] and ENV[“HTTPS_PROXY”] are set correctly). Has anyone faced a similar issue? I’m a bit stumped at this point.


Hm, very strange indeed. Is there something special about your home directory? Is it a network mount or anything other than just a regular folder on disk?


No, the proxys are the only “out of the norm” part of my setup from what I can tell.


You could experiment with setting JULIA_PKGDIR environment variable to confirm there’s nothing funky going on with your home directory.


Thanks for the suggestion, Same error though :frowning:.


Dang. Well, if it were me, this would be the part where I start trying some old-school debugging. The line where you’re getting the failure is in the call to cd() here: (you can find this source file in share/julia/base/pkg/dir.jl in wherever you unpacked the Julia release).

Editing that file won’t take effect unless you rebuild julia’s pre-compiled system image, but you should be able to replicate what it’s doing. It looks like it’s doing, roughly:

dir = Pkg.Dir.path()
temp_dir = mktempdir(dir)

and you should be able to run those steps from the command line. If you get the segfault, then at least you’re closer to understanding the problem and we can debug more. If not, then it might be something inside that do block that starts on the same line.


Great. Thanks for the help. This was really helpful! After looking through some of the code in dir.jl and running it via the interpreter it seems like this is indeed a Certificate verification error, but was for some reason hiding behind another bug. My guess is it failed to clone and the current code somehow ignored the git error and moved on to do something with the assumed downloaded code.

At any rate this is a much more manageable issue than the errors I was getting before. Thanks again for your help!