Elixir crashes on start after installing Erlang and Elixir from sources.

I have installed the latest Erlang on my Linux Mint 19.1 (based on Ubuntu 18.04) by compiling the source. Did not see any problems during Erlang install. After install Erlang starts fine and shows this line:

Erlang/OTP 21 [erts-10.2] [source] [64-bit] …

Then I downloaded the latest Elixir (1.8.1) source, built it with ‘make clean test’ and did not see any errors. However, when I start Elixir, it crashes with the following messages:
<><><> Start <><><>

=SUPERVISOR REPORT==== 4-Feb-2019::11:09:00.919986 ===
    supervisor: {local,'Elixir.Logger.Supervisor'}
    errorContext: start_error
    reason: noproc
    offender: [{pid,undefined},
               {id,'Elixir.Logger.ErrorHandler'},
               {mfargs,
                   {'Elixir.Logger.Watcher',watcher,
                       [error_logger,'Elixir.Logger.ErrorHandler',
                        {true,false,500},
                        link]}},
               {restart_type,permanent},
               {shutdown,5000},
               {child_type,worker}]
=CRASH REPORT==== 4-Feb-2019::11:09:00.919960 ===
  crasher:
    initial call: Elixir.Logger.Watcher:init/1
    pid: <0.90.0>
    registered_name: []
    exception exit: noproc
      in function  gen:do_for_proc/2 (gen.erl, line 228)
      in call from gen_event:rpc/2 (gen_event.erl, line 239)
      in call from 'Elixir.Logger.Watcher':init/1 (lib/logger/watcher.ex, line 66)
      in call from gen_server:init_it/2 (gen_server.erl, line 374)
      in call from gen_server:init_it/6 (gen_server.erl, line 342)
    ancestors: ['Elixir.Logger.Supervisor',<0.84.0>]
    message_queue_len: 0
    messages: []
    links: [<0.85.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 253
  neighbours:

=CRASH REPORT==== 4-Feb-2019::11:09:00.925714 ===
  crasher:
    initial call: application_master:init/4
    pid: <0.83.0>
    registered_name: []
    exception exit: {{shutdown,
                         {failed_to_start_child,'Elixir.Logger.ErrorHandler',
                             noproc}},
                     {'Elixir.Logger.App',start,[normal,[]]}}
      in function  application_master:init/4 (application_master.erl, line 138)
    ancestors: [<0.82.0>]
    message_queue_len: 1
    messages: [{'EXIT',<0.84.0>,normal}]
    links: [<0.82.0>,<0.43.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 193
  neighbours:

=INFO REPORT==== 4-Feb-2019::11:09:00.926183 ===
    application: logger
    exited: {{shutdown,
                 {failed_to_start_child,'Elixir.Logger.ErrorHandler',noproc}},
             {'Elixir.Logger.App',start,[normal,[]]}}
    type: temporary
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

{"init terminating in do_boot",{{badmatch,error},[{'Elixir.System',build,0,[{file,"lib/system.ex"},{line,172}]},{'Elixir.System',build_info,0,[{file,"lib/system.ex"},{line,164}]},{'Elixir.Kernel.CLI',parse_shared,2,[{file,"lib/kernel/cli.ex"},{line,153}]},{'Elixir.Kernel.CLI','shared_option?',3,[{file,"lib/kernel/cli.ex"},{line,113}]},{'Elixir.Kernel.CLI',main,1,[{file,"lib/kernel/cli.ex"},{line,14}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({{badmatch,error},[{Elixir.System,build,0,[{_},{_}]},{Elixir.System,build_info,0,[{_},{_}]},{Elixir.Kernel.CLI,parse_shared,2,[{_},{_}]},{Elixir.Kernel.CLI,shared_option?,

Crash dump is being written to: erl_crash.dump...done

<><><> End <><>

Please help.

Sounds like the paths aren’t being set. After you compiled Elixir did you sudo make install (or locally) it as well and use the scripts it installs to launch elixir?

Thank you, OvermindDL1.

Elixir has been installed and the paths were set. This is why elixir starts - although it immediately crashes. Also, iex starts, with similar errors, but it then works.

Also mix help works fine.

I recommend you to use asdf.


2 Likes

I recommend asdf as well, however compiling from source should also work fine as that’s what I do on a production server.

If iex launches with those same errors, that sounds like it’s just the Logger process that is not being found somehow…

Is there a way you could reproduce this in a docker image with precise steps (or a dockerfile) to recreate it? That way we can recreate it in a uniform sandbox that is the same among us? This sounds really weird… Are you using Elixir master as well or a versioned branch?

I found the answer - with the help of an experienced Linux sysadmin.
First I noticed that both elixir and iex worked without errors when I became root. Next, the sysadmin mentioned above, issued the command ‘sudo ldconfig’. Then everything worked.

2 Likes

Thank you, OvermindDL1 and Eiji.

I hope this will be helpful to others installing first latest Erlang/OTP from source and then latest Elixir from source on Ubuntu.

1 Like

That’s entirely unexpected! Did they strace/dtrace it or something to figure out that was needed?

Yes, he used strace.

2 Likes

I believe both the Erlang and Elixir core teams would find the info extremely helpful.

Can you manage to extract a step-by-step fix out of your sysadmin friend?

1 Like

There isn’t much I can add. The steps literally were:

  1. Download the latest Erlang/OTP source from https://www.erlang.org/ (on Feb 1st) and make/install it exactly as described in Readme.md. There were no errors.
  2. Start ‘erl’. Works fine.
  3. Download the latest Elixir source from https://elixir-lang.org/ (also on Feb 1st) and make/install it using just one command ‘make clean test’) as described in Readme.md. There were no errors.
  4. Start ‘iex’. Shows problems with lines “SUPERVISOR REPORT…” and “CRASH REPORT…” but then works.
  5. Start ‘elixir -v’. Shows problems with lines “SUPERVISOR REPORT…” and “CRASH REPORT…” and crashes.
  6. Become root. Try both ‘iex’ and ‘elixir -v’. Both work without problems.
  7. Issue command ‘strace elixir -v > /tmp/aaa’. Analyze results.
  8. Issue command ‘sudo ldconfig’.
  9. Both iex and elixir work without problems.

All the above done on Linux Mint 19.1 (based on Ubuntu 18.04), downloaded and installed a few days ago.

I hope guys in the core team will understand what links to what libraries ldconfig updated and maybe modify the installation script accordingly. I will be glad if this writeup helps others in the installation process.

1 Like

Thanks a lot!

@josevalim in case you are interested in a possible bug report.

This still seems so odd… ldconfig just updates the dynamic library information of the system, which shouldn’t be an issue for the BEAM unless the BEAM is using a dynamic library pre-existing on the system that wasn’t setup properly, which seems like other programs would likely have issues as well. I really wonder what library it was that was causing it that ldconfig fixed… Hmmm…

I don’t suppose that strace output was kept?

I have tried compiling latest otp source as well as Elixir source, but everything works without any problem. I can test it again for Linux Mint in virtual machine if somebody would still have such problems.

$ elixir -v
Erlang/OTP 22 [DEVELOPMENT] [erts-10.2.3] [source-e82637d6f0] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Elixir 1.9.0-dev (e18d46f60) (compiled with Erlang/OTP 22)
1 Like

I do have the strace output. It is 2,030 lines long and is too large for the reply at this forum. I can send you a portion or do a lookup for you for specific items. Or send it to you some other way, please suggest.

1 Like

For such things you should use 3rd-party services like:

1 Like

Pastebin or https://gist.github.com/ or so are usually easiest. :slight_smile:

1 Like

I used pastebin per Eiji’s suggestion. The link is:

https://pastebin.com/YvQmWcMh

3 Likes

Hmm, the ld cache file was found and loaded…
nohwcap is not existing (this is good).
Elixir tried to find erl so the system searched the PATH’s until it was found.
Not seeing anything else that is leaping out at me…

Yeah I’m not sure how they came up with running ldconfig. Running that still should not have been needed at all unless some shared library was installed not via a package manager, and Linux Mint is based on Ubuntu, which uses apt, which definitely calls ldconfig itself…

Was something like wxWidgets development libraries manually compiled and installed as well perhaps? Or something else before elixir/erlang before a restart was done (ldconfig is also automatically run on a fresh bootup as I recall)?

/me is so confused…

1 Like