title: Erlang: Cannot start supervisor on another node
body: <p>I have a simple supervisor that looks like this</p>
  <pre><code>-module(a_sup).
  -behaviour(supervisor).
  
  %% API
  -export([start_link/0, init/1]).
  
  start_link() -&gt;
    supervisor:start_link({local,?MODULE}, ?MODULE, []).
  
  init(_Args) -&gt;
    RestartStrategy = {simple_one_for_one, 5, 3600},
    ChildSpec = {
      a_gen_server,
      {a_gen_server, start_link, []},
      permanent,
      brutal_kill,
      worker,
      [a_gen_server]
    },
    {ok, {RestartStrategy,[ChildSpec]}}.
  </code></pre>
  <p>When I run this on the shell, it works perfectly fine. But now I want to run different instances of this supervisor on different nodes, called foo and bar (started as <code>erl -sname foo</code> and <code>erl -sname bar</code>, from a separate node called main <code>erl -sname main</code>). This is how I try to initiate this <code>rpc:call('foo@My-MacBook-Pro',  a_sup, start_link, []).</code>, but after replying with ok it immediately fails with this message</p>
  <pre><code>{ok,&lt;9098.117.0&gt;}
  =ERROR REPORT==== 7-Mar-2022::16:05:45.416820 ===
  ** Generic server a_sup terminating 
  ** Last message in was {'EXIT',&lt;9098.116.0&gt;,
                                 {#Ref&lt;0.3172713737.1597505552.87599&gt;,return,
                                  {ok,&lt;9098.117.0&gt;}}}
  ** When Server state == {state,
                              {local,a_sup},
                              simple_one_for_one,
                              {[a_gen_server],
                               #{a_gen_server =&gt;
                                     {child,undefined,a_gen_server,
                                         {a_gen_server,start_link,[]},
                                         permanent,false,brutal_kill,worker,
                                         [a_gen_server]}}},
                              {maps,#{}},
                              5,3600,[],0,never,a_sup,[]}
  ** Reason for termination ==
  ** {#Ref&lt;0.3172713737.1597505552.87599&gt;,return,{ok,&lt;9098.117.0&gt;}}
  
  (main@Prachis-MacBook-Pro)2&gt; =CRASH REPORT==== 7-Mar-2022::16:05:45.416861 ===
    crasher:
      initial call: supervisor:a_sup/1
      pid: &lt;9098.117.0&gt;
      registered_name: a_sup
      exception exit: {#Ref&lt;0.3172713737.1597505552.87599&gt;,return,
                       {ok,&lt;9098.117.0&gt;}}
        in function  gen_server:decode_msg/9 (gen_server.erl, line 481)
      ancestors: [&lt;9098.116.0&gt;]
      message_queue_len: 0
      messages: []
      links: []
      dictionary: []
      trap_exit: true
      status: running
      heap_size: 610
      stack_size: 29
      reductions: 425
    neighbours:
  </code></pre>
  <p>From the message it looks like the call expects the supervisor to be a gen_server instead? And when I try to initiat a gen_server on the node like this, it works out just fine, but not with supervisors. I can't seem to figure out if there's something different in trying to initiate supervisor on local/remote nodes, and if yes, what should we do to fix the issue?</p>