Author Topic: Pi Stack Setup toubleshooting  (Read 3594 times)

tom.rubel@me.com

  • NewMember
  • *
  • Posts: 2
Pi Stack Setup toubleshooting
« on: May 04, 2015, 04:32:33 PM »
I am very excited to implement this.  I have struggled to get my pi to function as a serial gateway for my moteino army.  I have tried every solution I can find, and jumped on this as soon as you posted the code yesterday.

All proceeded swimmingly until I tried to set up /etc/nginx/sites-available/default and restart nginx whereupon I encountered the following. 

root@PiGateway:~# sudo nano /etc/nginx/sites-available/default
root@PiGateway:~# cd /etc/nginx/sites-enabled/
root@PiGateway:/etc/nginx/sites-enabled# sudo ln -s /etc/nginx/sites-available/default
root@PiGateway:/etc/nginx/sites-enabled# sudo service nginx restart
Restarting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.

I did not start from scratch but rather added your solution on a pi2 which already had the latest thingbox (node red, mosquitto) + webmin (requires LAMP install)+ openhab.  Conflict?

I tried changing localhost to the pi's actual ip address (ie 192.168.1.xxx) but the outcome was the same.

If you have any suggestions I would be very grateful.

Great job on the whole Moteino thing BTW.  Great product line and community.  Fun to watch the growth and development.



Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Pi Stack Setup toubleshooting
« Reply #1 on: May 04, 2015, 05:11:00 PM »
Tom,
Thanks for the feedback.
It seems every time someone reports running into an error, it is something else. Not having seen this particular one before I don't know what it is and how to debug.
I would recommend starting with a fresh install of raspbian and follow the guide i posted at lowpowerlab.com/gateway
I will try to prepare an image and post it for people to just download that but in the meantime the guide is there to assist.

jra

  • Jr. Member
  • **
  • Posts: 81
  • Country: us
Re: Pi Stack Setup toubleshooting
« Reply #2 on: May 04, 2015, 05:40:24 PM »
That message looks like some service is already listening to port 80, another web server perhaps?  lsof is your friend, execute:

lsof -P -iTCP

as root and look for the line that contains:

TCP *:80 (LISTEN)

That should tell you what has the port open so you know what service to disable.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Pi Stack Setup toubleshooting
« Reply #3 on: May 04, 2015, 09:09:08 PM »
That message looks like some service is already listening to port 80, another web server perhaps?  lsof is your friend, execute:

lsof -P -iTCP

as root and look for the line that contains:

TCP *:80 (LISTEN)

That should tell you what has the port open so you know what service to disable.
Cool!  Thanks for the info! VERY useful!

Tom

tom.rubel@me.com

  • NewMember
  • *
  • Posts: 2
Re: Pi Stack Setup toubleshooting
« Reply #4 on: May 05, 2015, 03:47:25 PM »
Thanks for all the suggestions.
 
I started with a fresh install of 2015-02-16-raspbian-wheezy on a pi2.  Followed instructions as best I could but still a dry heave at the same place

root@raspberrypi:~# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()
root@raspberrypi:~#

Will wait for an image!

jra

  • Jr. Member
  • **
  • Posts: 81
  • Country: us
Re: Pi Stack Setup toubleshooting
« Reply #5 on: May 05, 2015, 04:08:23 PM »
Port 80 is the default http port while port 443 is the default https port.  If you installed the LAMP stack you probably got the apache web server installed and running (it's the A in LAMP).
If so, try shutting it off via:

service apache2 stop

If that doesn't complain, try running nginx again.  If that works you can prevent apache from starting the next time the system is booted via:

chkconfig apache2 off

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Pi Stack Setup toubleshooting
« Reply #6 on: May 12, 2015, 10:44:07 PM »
Good news: gateway guide was updated and a link to a completely setup and ready to go Pi image was posted here. It includes the web stack install and also all the files with some sample node data so it should run out of the box and you should not have much else to do except perhaps change passwords for the Pi and for the web auth (which you should actually do to make it secure). If you want to send email/SMS you need to put your email and mobile settings in gateway.js.
Let me know if there is any issue with it.
Enjoy!
« Last Edit: May 18, 2015, 12:07:34 PM by Felix »