Page 1 of 2

Services might still be starting... Forever

PostPosted: Sat Mar 21, 2015 1:56 pm
by Maxburn
Been running fine for a week or two and I asked about SSL for the Webapp but never got around to it. Today I got this message below when trying to get into the Webapp. SSH still works and I told it to reboot, still not working SSH shutdown and pulled the power got the same message after rebooting.

Services might still be starting - please wait and try again. If this continues, please let us know on GitHub. You can also email us at Support.

I searched but didn't see instructions on what log you would need or how to get it?

Re: Services might still be starting... Forever

PostPosted: Sun Mar 22, 2015 4:10 pm
by Maxburn
Found this in syslog
Code: Select all
alarmdecoder ser2sock[2127]: [‼] Error opening pid file /var/run/ser2sock.pid

and this in nginx log
Code: Select all
2015/03/22 21:33:12 [error] 2084#0: *23 connect() failed (111: Connection refused) while connecting to upstream, client: {my ip}, server: , request: "GET /keypad/ HTTP/1.1", upstream: "http://127.0.0.1:5000/keypad/", host: "{my host}"
2015/03/22 21:33:12 [error] 2084#0: *23 connect() failed (111: Connection refused) while connecting to upstream, client: {my ip}, server: , request: "GET /static/favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/static/favicon.ico", host: "{myhost}"
2015/03/22 21:35:58 [error] 2084#0: *26 connect() failed (111: Connection refused) while connecting to upstream, client: {ip}, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "{host}"


Don't really know what I'm looking at.

Re: Services might still be starting... Forever

PostPosted: Sun Mar 22, 2015 5:05 pm
by Maxburn
Might be hardware? I downloaded the Raspbian image and flashed that to another SD card I had here and got exactly the same results. I even tried putting it back on the external power supply. Already restarted the alarm system and my keypads work fine. Suggestions?

Re: Services might still be starting... Forever

PostPosted: Sun Mar 22, 2015 6:21 pm
by kevin
Please make sure ser2sock is functioning correctly by telnetting to port 10000 and see if you can communicate with the alarm successfully

After that, make sure to look at the gunicorn logs - it looks as if the wsgi is not starting properly to accept connections

Re: Services might still be starting... Forever

PostPosted: Mon Mar 23, 2015 2:47 pm
by Maxburn
I tried telnet and didn't really get anything, sent C and it closed the session. Sent my code+1 and it closed the connection. I've not really tried to do anything here, not sure what I'm supposed to be getting or even sending.

Next part is weird
Code: Select all
Status:          Listing directory /
Status:          Directory listing of "/" successful
Status:          Retrieving directory listing of "/var"...
Status:          Listing directory /var
Status:          Directory listing of "/var" successful
Status:          Retrieving directory listing of "/var/log"...
Status:          Listing directory /var/log
Status:          Directory listing of "/var/log" successful
Status:          Retrieving directory listing of "/var/log/gunicorn"...
Command:    cd "gunicorn"
Error:            Directory /var/log/gunicorn: permission denied
Error:            Failed to retrieve directory listing

Re: Services might still be starting... Forever

PostPosted: Mon Mar 23, 2015 4:25 pm
by kevin
Well, we need to make sure your device is working properly and communicating with the alarm panel.

Do you have an AD2Pi or and AD2USB?

SSH into the pi and make sure all ser2sock, nginx, and gunicorn processes are stopped.

Use a serial program such as screen to verify your device works properly

if AD2PI:

sudo screen /dev/ttyAMA0 115200

make sure you are seeing alarm messages and you are able to arm/disarm

if AD2USB:

sudo screen /dev/ttyUSB0 115200 (ttyUSB0 is default, make sure actual device path of your device by checking dmesg and lsusb)

again try to arm/disarm/view messages


Once you have verified it is not a hardware issue, I would suggest removing your database file for the webapp (in /opt/alarmdecoder-webapp) and restarting and going through setup again.


If it's a hardware issue, or still can't be resolved please email ad2usb@support.nutech.com for further troubleshooting - maybe getting us SSH access to see if we can help/check it out.

Re: Services might still be starting... Forever

PostPosted: Mon Mar 23, 2015 4:50 pm
by Maxburn
This is an ad2pi.

Thank you for the instructions, I was able to go in and see the messages, arm and disarm etc using sudo screen /dev/ttyAMA0 115200. I guess the hardware is good.

Exactly what files should I be deleting?

Re: Services might still be starting... Forever

PostPosted: Mon Mar 23, 2015 6:00 pm
by kevin
you would be deleting /opt/alarmdecoder-webapp/instance/db.sqlite


Also make sure the /etc/ser2sock/ser2sock.conf is defaulted as such:

Code: Select all
[ser2sock]
daemonize = 1
device = /dev/ttyAMA0
baudrate = 115200
port = 10000
raw_device_mode = 1
preserve_connections = 1
bind_ip = 0.0.0.0
send_terminal_init = 0
device_open_delay = 5000
encrypted = 0
ca_certificate =
ssl_certificate =
ssl_key =
ssl_crl = /etc/ser2sock/ser2sock.crl



Then you should be able to reboot, and provided your nginx and gunicorn configs haven't been changed - go through the webapp setup and start again.

Re: Services might still be starting... Forever

PostPosted: Tue Mar 24, 2015 2:25 pm
by Maxburn
OK, I did those two things and found what happened below but now I have a new problem. Now the web page says starting up for a while and then faults out with this error. I did confirm that it successfully made a new database file, I can see the file.
Code: Select all
sqlalchemy.exc.OperationalError

OperationalError: (OperationalError) no such table: settings u'SELECT settings.id AS settings_id, settings.name AS settings_name, settings.int_value AS settings_int_value, settings.string_value AS settings_string_value \nFROM settings \nWHERE settings.name = ?\n LIMIT ? OFFSET ?' ('setup_stage', 1, 0)



I discovered what I did. In the middle of last week sometime I went through the config in the webapp not really understanding the options and turned on SSL so that ser2sock.conf file looked like this for me below, I think I was looking for the webapp SSL. I never really connected the two in my mind because I didn't reboot the device to see the change? Somewhere along the line it must have rebooted and wound up using this config.

What I don't understand is why the replacement system image acted the same way, I didn't get a chance to edit that and the symptoms seemed the same.

Code: Select all
[ser2sock]
daemonize = 1
device = /dev/ttyAMA0
baudrate = 115200
port = 10000
raw_device_mode = 1
preserve_connections = 1
bind_ip = 0.0.0.0
send_terminal_init = 0
device_open_delay = 5000
encrypted = 1
ca_certificate = /etc/ser2sock/certs/AlarmDecoder CA.pem
ssl_certificate = /etc/ser2sock/certs/AlarmDecoder Server.pem
ssl_key = /etc/ser2sock/certs/AlarmDecoder Server.key
ssl_crl = /etc/ser2sock/ser2sock.crl

Re: Services might still be starting... Forever

PostPosted: Tue Mar 24, 2015 2:57 pm
by kevin
You might need to do this:

Code: Select all
cd /opt/alarmdecoder-webapp

sudo python manage.py initdb


This should go through and make sure all the tables are properly created - I forgot to include this step in my previous instructions, sorry. You will still see the error with regards to the settings table, but you should be able to ignore it after this point.

And that SSL is just for ser2sock, not the webapp - I think the error actually stems from the spaces in your filenames