Closed hallard closed 6 years ago
Tough problem. Did you try running the start-stop-daemon
command from the console to see if that works? Some more error can be reported from the start-stop-daemon
in syslog. Is there something?
yeah I tried that but no output
ttn-gw06:/usr/lib/lorawan-server$ sudo /sbin/start-stop-daemon --background --start --chuid lorawan --make-pidfile --pidfile /var/run/lora/lorawan-server-1.pid --startas /bin/bash -- -c "LORAWAN_HOME=/usr/lib/lorawan-server LORAWAN_LOG_ROOT=/usr/lib/lorawan-server/log /usr/lib/lorawan-server/bin/lorawan-server"
ttn-gw06:/usr/lib/lorawan-server$
then you give an idea, remove the --background and here it is
ttn-gw06:/usr/lib/lorawan-server$ sudo /sbin/start-stop-daemon --start --chuid lorawan --make-pidfile --pidfile /var/run/lora/lorawan-server-1.pid --startas /bin/bash -- -c "LORAWAN_HOME=/usr/lib/lorawan-server LORAWAN_LOG_ROOT=/usr/lib/lorawan-server/log /usr/lib/lorawan-server/bin/lorawan-server"
2017-12-14 11:24:43 {{error,"Error when reading /home/root/.erlang.cookie: eacces"},[]}
2017-12-14 11:24:43 crash_report
initial_call: {auth,init,['Argument__1']}
pid: <0.47.0>
registered_name: []
error_info: {error,{error,"Error when reading /home/root/.erlang.cookie: eacces"},[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
ancestors: [net_sup,kernel_sup,<0.36.0>]
message_queue_len: 0
messages: []
links: [<0.45.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 610
stack_size: 27
reductions: 560
2017-12-14 11:24:43 supervisor_report
supervisor: {local,net_sup}
errorContext: start_error
reason: {{error,"Error when reading /home/root/.erlang.cookie: eacces"},[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
offender: [{pid,undefined},{id,auth},{mfargs,{auth,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]
2017-12-14 11:24:43 supervisor_report
supervisor: {local,kernel_sup}
errorContext: start_error
reason: {shutdown,{failed_to_start_child,auth,{{error,"Error when reading /home/root/.erlang.cookie: eacces"},[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}}}
offender: [{pid,undefined},{id,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]
2017-12-14 11:24:43 crash_report
initial_call: {application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}
pid: <0.35.0>
registered_name: []
error_info: {exit,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{{error,"Error when reading /home/root/.erlang.cookie: eacces"},[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,134}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
ancestors: [<0.34.0>]
message_queue_len: 1
messages: [{'EXIT',<0.36.0>,normal}]
links: [<0.34.0>,<0.33.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 987
stack_size: 27
reductions: 248
2017-12-14 11:24:43 std_info
application: kernel
exited: {{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{{error,"Error when reading /home/root/.erlang.cookie: eacces"},[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}}}}},{kernel,start,[normal,[]]}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{{error,\"Error when reading /home/root/.erlang.cookie: eacces\"},[{auth,init_cookie,0,[{file,\"auth.erl\"},{line,286}]},{auth,init,1,[{file,\"auth.erl\"},{line,140}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,365}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{{error,"Error when reading /home/root
Crash dump is being written to: erl_crash.dump...done
ttn-gw06:/usr/lib/lorawan-server$
Tried to 0755 .erlang.cookie, but same error
ttn-gw06:/usr/lib/lorawan-server$ sudo chmod 0777 /home/root/.erlang.cookie
ttn-gw06:/usr/lib/lorawan-server$ sudo ls -al /home/root/
/home/root/:
total 3
drwx------ 2 root root 1024 Oct 24 00:56 .
drwxr-xr-x 4 root root 1024 Oct 24 00:24 ..
-rwxrwxrwx 1 root root 20 Oct 24 00:00 .erlang.cookie
ttn-gw06:/usr/lib/lorawan-server$
The question is why is he reading the cookie from /home/root
? It should be read from whatever the home for the lorawan
user is, most preferrably the /usr/lib/lorawan-server
.
I think it's because of sudo, but I'm not sure, and as init.d script are launched by root that may be the issue. But it's very strange, on another target with systemd it works fine.
Solved !!
Change in /etc/init.d/lorawan-server
do_start() {
echo -n "Starting $NAME: "
mkdir -p $run_dir
/sbin/start-stop-daemon --background --start --chuid lorawan \
--make-pidfile --pidfile $server_pidfile --startas /bin/bash -- \
-c "LORAWAN_HOME=/usr/lib/lorawan-server LORAWAN_LOG_ROOT=/usr/lib/lorawan-server/log /usr/lib/lorawan-server/bin/lorawan-server"
echo "OK"
}
by
do_start() {
echo -n "Starting $NAME: "
mkdir -p $run_dir
/sbin/start-stop-daemon --background --start -u lorawan \
--make-pidfile --pidfile $server_pidfile --startas /bin/bash -- \
-c "LORAWAN_HOME=/usr/lib/lorawan-server LORAWAN_LOG_ROOT=/usr/lib/lorawan-server/log /usr/lib/lorawan-server/bin/lorawan-server"
echo "OK"
}
in fact this --chuid lorawan
should be -u lorawan
I'm trying to run the server on a LorixOne (yocto), I've made an SD image that I put into the Lorix One gateway and all is fine (network, packet forwarder, lorawan-server, ..) but I'm able to manually start the lorawan-server service
As you can see all is in /usr/lib/lorawan-server is owned my lorawan user so all looks good
running as lorawan user works fine I can go to web interface on 8080
running as admin (default lorix user) with sudo works fine also I can go to web interface on 8080
but trying to auto start the service does not work, I even tried to put all on the same folder (log)
/usr/lib/loarawan-server
to see but nothing, it start then crashhere my
/etc/init.d/lorawan-server
I'm pretty sure it's permission related but I have no trace, no log of the error so I'm stuck, so how can I see log ? Any idea of the issue ?
Oh, forgot to mention, I do not have systemd on the device ;-)
Thanks