[erlang-questions] erl_boot_server and loading code over network

Viacheslav V. Kovalev <>
Sun Jul 5 19:11:51 CEST 2015


Hi folks! I'm playing with erl_boot_servers and have several questions
about how code get loaded to node over the network.

I've started with trivial release (stdlib, kernel and one my stub
application which actually does nothing). Here is it:

[ foobar]$ tree -L 2
.
|-- bin
|   |-- foobar
|   |-- foobar-0.0.0+build.1.ref307ae38
|   |-- install_upgrade.escript
|   |-- nodetool
|   `-- start_clean.boot
|-- erts-6.1
|   |-- bin
|   |-- doc
|   |-- include
|   |-- lib
|   |-- man
|   `-- src
|-- lib
|   |-- foobar-0.1.0
|   |-- kernel-3.0.1
|   |-- sasl-2.4
|   `-- stdlib-2.1
`-- releases
    |-- 0.0.0+build.1.ref307ae38
    |-- RELEASES
    `-- start_erl.data

Then I start boot node:

[ foobar]$ erl -sname boot -pa lib/*/ebin -pa
releases/0.0.0+build.1.ref307ae38/ -s erl_boot_server start localhost

()1> {ok, _, _} = erl_prim_loader:get_file("foobar.boot").
()2> {ok, _, _} = erl_prim_loader:get_file("foobar_app.beam").

Alright. Seems, all necessary code available. Well, then start slave
node. Note, I intendedly starts it in /tmp or somewhere away of my
release.

[ /tmp]$ erl -sname slave -loader inet -hosts 127.0.0.1
 -boot foobar
{"init terminating in do_boot",{'cannot get bootfile','foobar.boot'}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

I dug into erl_prim_loader, init and friends and got confused with all
those paths manipulation that they performs.

1. First thing -
https://github.com/erlang/otp/blob/maint/erts/preloaded/src/erl_prim_loader.erl#L669.
erl_prim_loader (in inet mode) for some (unclear for me) reasons tries
to cripple any requested module with local (clientside) paths.

2. It seems there is no way to force loader on slave node to keep its
paths empty: https://github.com/erlang/otp/blob/maint/erts/preloaded/src/init.erl#L697

3. Paths in my bootscript looks like
{path,["$ROOT/lib/kernel-4.0/ebin","$ROOT/lib/stdlib-2.5/ebin"]}, so
it seems, if I'll get bootscript loaded, anyway, I won't be able boot
system with it.

What's going on? Is erlang network boot feature broken? Or just my
brains? How could I get node successfully network-booted?


More information about the erlang-questions mailing list