Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck at $sudo npm start, dhcp server fail? Raspberry Pi 3 Model B #28

Open
smallzZz8 opened this issue Sep 27, 2017 · 37 comments
Open

Comments

@smallzZz8
Copy link

smallzZz8 commented Sep 27, 2017

So I have tried installing this several times but I am getting stuck at the last step. I freshly installed the newest version of raspbian stretch and I follow the installation steps but when I get to $sudo npm start my terminal says this

pi@raspberrypi:~/raspberry-wifi-conf $ sudo npm start
 
> [email protected] start /home/pi/raspberry-wifi-conf
> node server.js
 
 
Wifi is not enabled, Enabling AP for self-configure
 
Force reconfigure enabled - reset AP
... dhcp server failed! -
ifdown wlan0 successful...
ifup wlan0 successful...
... hostapd restarted!
... AP Enable Success!
 
HTTP server running...

Why is this happening? I would post my full terminal but I thought it was too long so if you need to see my full terminal with how everything installed it can be found here https://pastebin.com/BZNDsfhn .

Now since it gets stuck at that command I am forced to restart my terminal since I cant type anymore and if I re-enter the command $sudo npm start I get this

pi@raspberrypi:~ $ cd raspberry-wifi-conf
pi@raspberrypi:~/raspberry-wifi-conf $ sudo npm start
 
> [email protected] start /home/pi/raspberry-wifi-conf
> node server.js
 
 
Wifi is not enabled, Enabling AP for self-configure
 
Force reconfigure enabled - reset AP
... dhcp server restarted!
ifdown wlan0 successful...
ifup wlan0 successful...
... hostapd restarted!
... AP Enable Success!
 
HTTP server running...
events.js:163
      throw er; // Unhandled 'error' event
      ^
 
Error: listen EADDRINUSE :::88
    at Object.exports._errnoException (util.js:1050:11)
    at exports._exceptionWithHostPort (util.js:1073:20)
    at Server.setupListenHandle [as _listen2] (net.js:1259:14)
    at listenInCluster (net.js:1307:12)
    at Server.listen (net.js:1406:7)
    at Function.app.listen (/home/pi/raspberry-wifi-conf/node_modules/express/lib/application.js:559:24)
    at module.exports (/home/pi/raspberry-wifi-conf/app/api.js:76:9)
    at start_http_server (/home/pi/raspberry-wifi-conf/server.js:70:32)
    at /home/pi/raspberry-wifi-conf/node_modules/async/lib/async.js:607:21
    at /home/pi/raspberry-wifi-conf/node_modules/async/lib/async.js:246:17
 
npm ERR! Linux 4.9.41-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v7.10.1
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the raspberry-wifi-conf package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs raspberry-wifi-conf
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls raspberry-wifi-conf
npm ERR! There is likely additional logging output above.
 
npm ERR! Please include the following file with any support request:
npm ERR!     /root/.npm/_logs/2017-09-27T06_10_58_899Z-debug.log
pi@raspberrypi:~/raspberry-wifi-conf $

I assume that is probably happening because the first start did not work but maybe it has some information in it that can help you determine the issue. Looking at the first code I posted at the top could it be something to do with my dhcp server failing? How do I fix this? Thank you for any help!!

@smallzZz8 smallzZz8 changed the title Stuck at $sudo npm start Stuck at $sudo npm start, dhcp server fail? Sep 27, 2017
@smallzZz8 smallzZz8 changed the title Stuck at $sudo npm start, dhcp server fail? Stuck at $sudo npm start, dhcp server fail? Raspberry Pi 3 Model B Sep 27, 2017
@sabhiram
Copy link
Owner

That is super odd, are you running the latest source? I really should tag these for releases, I suppose I will do that once we fix these gaps :)

Let me run this on my Pi3 once I am home and try and debug some of this.

@sabhiram
Copy link
Owner

The ADDR in use sounds like the server is already running. Could it be that when you rebooted it - the service that kicks it off on boot started it?

Also - did you read the bit about the denyinterface thingy in the README?

@smallzZz8
Copy link
Author

Big thanks for the reply!

I did indeed do the denyinterface part and yes I am running the latest version of Raspbian and the latest version of the code comes with the git clone that is listed in the instruction right?

Did you check out my full terminal log? https://pastebin.com/BZNDsfhn I did everything correct right and in order? Could you possibly post an image with a working version if you are not sure what to try? Again super big thanks for the reply!

@sabhiram
Copy link
Owner

In your case, the very last line in your full terminal output seems to indicate that when running as sudo things seem to startup correctly? However the log pasted above indicates that the port (88) is already in use.

Try to check and see if you have an instance of node still running with:
ps aux | grep "node"

Can you confirm that the isc-dhcp-server service is installed and can be started?

This "tool" is just a collection of terminal commands followed by a http server which conveys the iwscan results. My next recommendation would be to look at the contents of the "enable_ap" function and try and follow the terminal commands / file edits one at a time until it breaks. Based on what I see above, I am not sure where this is failing for you. I will try to reproduce on my pi3 which is currently in a rc car somewhere :)

Sorry this is so buggy, this was mostly a script that I threw together ages ago when I had to constantly get our companies army of pi2 on a new wifi network often. I am happy to help you work this out, however.

@smallzZz8
Copy link
Author

Okay I just got home and plan to be on for several more hours and it seems that you just made that post. Right now I am going to install the latest flash and say step by step what I will be doing. If you plan to be on for a little longer I should respond pretty quick.

@sabhiram
Copy link
Owner

Yessir, I should be on and off tonight - happy to help!

@smallzZz8
Copy link
Author

smallzZz8 commented Sep 29, 2017

Okay so here I am giving it another try. In this post I will post the exact order that I do things. I am going to post a full log at the end so you can see everything.

To start off, this is a fresh install of raspbian stretch from their website.
I turn on VNC so I can use from my main computer
First must do the updates for npm

sudo apt-get update
sudo apt-get install npm

So if I am correct the instructions say that I need the NodeJS from Underscore, async, and express so,

npm install underscore
install --save async
npm install express

Then as the instructions say the next thing to do is get bower so,
sudo npm install bower -g
Then I have to generate a new SSH because I am denied permssion, (Check full log to see what I mean.) To do that I have to do,
ssh-keygen -t rsa -b 4096 -C "[email protected]"
And I will follow the rest of the instructions as to generating a new SSH from the github website

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub

Then Ill paste the key to github and now I can resume the installation.

git clone [email protected]:sabhiram/raspberry-wifi-conf.git
cd raspberry-wifi-conf
npm update
bower install
sudo npm run-script provision

(Just want to point out here that when this npm run-script was run at the bottom there is some red code saying stuff failed, I will post a gyazo to hopefully make it easier for you to find https://gyazo.com/ecd57e8b84f4c266b11bc6b2616fd03d )
Then before I run the start script I want to make sure denyinterfaces command is ran so I will do it manually and place it at the very first line of the /etc/dhcpcd.conf file
nano /etc/dhcpcd.conf
Then CTRL-O to save, then Enter, and CTRL-X to exit out. (I rechecked the file to make sure it saved.)
Now time to run that start command.
sudo npm start

Ya well and we fail at the same spot. Is it because I am already using wifi? Should I be using ethernet to install? Should I not have chromium open when I do this? (I use it to copy and paste) Should I not have VNC enabled? I really don't know why its working for other people but not me? Heres the full log, https://pastebin.com/cRUbZsaW

@smallzZz8
Copy link
Author

Thoughts? Or anything I should try?

@sabhiram
Copy link
Owner

Oh man - you can git clone using the http version and not generate a key etc.

@smallzZz8
Copy link
Author

*Facepalm XD

I am still learning, I was wondering why other projects didnt make me do this. If I reset again now I know lmao

@sabhiram
Copy link
Owner

The red thing at the bottom is def your DHCP server failing to start. This could perhaps be because ifplugd is taking control of wlan0. Could you try posting what /etc/default/ifplugd contains?

The INTERFACES should change from "auto" to "eth0" and the HOTPLUG_INTERFACES should go from "all" to "eth0" as well.

Try that and let me know.

@sabhiram
Copy link
Owner

sabhiram commented Sep 29, 2017

Hehe - I updated the readme to avoid that :)

Also your log states this:

   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2017-09-29 03:33:03 UTC; 88ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 12285 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
 
Sep 29 03:33:00 raspberrypi systemd[1]: Starting LSB: DHCP server...
Sep 29 03:33:00 raspberrypi isc-dhcp-server[12285]: Launching both IPv4 and I…).
Sep 29 03:33:01 raspberrypi dhcpd[12305]: Wrote 0 leases to leases file.
Sep 29 03:33:03 raspberrypi isc-dhcp-server[12285]: Starting ISC DHCPv4 serve…d!
Sep 29 03:33:03 raspberrypi isc-dhcp-server[12285]:  failed!
Sep 29 03:33:03 raspberrypi systemd[1]: isc-dhcp-server.service: Control pro…s=1
Sep 29 03:33:03 raspberrypi systemd[1]: Failed to start LSB: DHCP server.
Sep 29 03:33:03 raspberrypi systemd[1]: isc-dhcp-server.service: Unit entere…te.
Sep 29 03:33:03 raspberrypi systemd[1]: isc-dhcp-server.service: Failed with…e'.```

So seems like its around the DHCP server.

@smallzZz8
Copy link
Author

smallzZz8 commented Sep 29, 2017

So I have nothing in the ifplugd file? Its just blank, heres the nano. https://gyazo.com/a7ba619c082cd80de0e86db6f8485e4e

EDIT: I dont even have the file? https://gyazo.com/d9d73a2c31da8df5913b59d5a88e023f

@sabhiram
Copy link
Owner

Try doing this: sudo service isc-dhcp-server restart and post the output. Also try service isc-dhcp-server status

@smallzZz8
Copy link
Author

Ok done and I get this (keep in mind this is the next day so my pi has been rebooted)

pi@raspberrypi:~ $ sudo service isc-dhcp-server restart
pi@raspberrypi:~ $ sudo service isc-dhcp-server status
● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enable
   Active: active (running) since Fri 2017-09-29 08:17:45 UTC; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 905 ExecStop=/etc/init.d/isc-dhcp-server stop (code=exited, status=0/
  Process: 919 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=
   CGroup: /system.slice/isc-dhcp-server.service
           └─932 /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf wlan0

Sep 29 08:17:43 raspberrypi isc-dhcp-server[919]: Migrating automatically for no
Sep 29 08:17:43 raspberrypi isc-dhcp-server[919]: Launching IPv4 server only.
Sep 29 08:17:43 raspberrypi dhcpd[931]: Internet Systems Consortium DHCP Server 
Sep 29 08:17:43 raspberrypi dhcpd[931]: Copyright 2004-2016 Internet Systems Con
Sep 29 08:17:43 raspberrypi dhcpd[931]: All rights reserved.
Sep 29 08:17:43 raspberrypi dhcpd[931]: For info, please visit https://www.isc.o
Sep 29 08:17:43 raspberrypi dhcpd[931]: Wrote 0 leases to leases file.
Sep 29 08:17:43 raspberrypi dhcpd[932]: Server starting service.
Sep 29 08:17:45 raspberrypi isc-dhcp-server[919]: Starting ISC DHCPv4 server: dh
Sep 29 08:17:45 raspberrypi systemd[1]: Started LSB: DHCP server.
lines 1-19/19 (END)

Also note that this kills my console so I have to close it and open another to enter another command. In other words it does let me put in more commands after this.

@sabhiram
Copy link
Owner

It seems like it started ok that time, could you do that first, and then start the app on another terminal just to see if things play nicely? Maybe we just need to try to start the dhcp service on failure.

@smallzZz8
Copy link
Author

So you want me to run the dhcp restart command and then try the start command. I will try that when I get home tonight. My raspberry pi has been powered on and off since then which should be okay right?

Anyways I'll let you know what happens when I try tonight.

@sabhiram
Copy link
Owner

sabhiram commented Oct 1, 2017

No problem. I will try and reproduce a from-scratch-with-latest test since it seems like more then one person has this symptom.

@smallzZz8
Copy link
Author

Well clearly I didn't get to it last night, but here it is. I did separate terminals like you said and still nothing.

 pi@raspberrypi:~ $ sudo service isc-dhcp-server restart
pi@raspberrypi:~ $ sudo service isc-dhcp-server status
● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enable
   Active: active (running) since Fri 2017-09-29 22:19:40 UTC; 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 908 ExecStop=/etc/init.d/isc-dhcp-server stop (code=exited, status=0/
  Process: 922 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=
   CGroup: /system.slice/isc-dhcp-server.service
           └─935 /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf wlan0

Sep 29 22:19:37 raspberrypi isc-dhcp-server[922]: Migrating automatically for no
Sep 29 22:19:37 raspberrypi isc-dhcp-server[922]: Launching IPv4 server only.
Sep 29 22:19:37 raspberrypi dhcpd[934]: Internet Systems Consortium DHCP Server 
Sep 29 22:19:37 raspberrypi dhcpd[934]: Copyright 2004-2016 Internet Systems Con
Sep 29 22:19:37 raspberrypi dhcpd[934]: All rights reserved.
Sep 29 22:19:37 raspberrypi dhcpd[934]: For info, please visit https://www.isc.o
Sep 29 22:19:37 raspberrypi dhcpd[934]: Wrote 1 leases to leases file.
Sep 29 22:19:38 raspberrypi dhcpd[935]: Server starting service.
Sep 29 22:19:40 raspberrypi isc-dhcp-server[922]: Starting ISC DHCPv4 server: dh
Sep 29 22:19:40 raspberrypi systemd[1]: Started LSB: DHCP server.
lines 1-19/19 (END)

And second,

pi@raspberrypi:~ $ cd raspberry-wifi-conf
pi@raspberrypi:~/raspberry-wifi-conf $ sudo npm start

> [email protected] start /home/pi/raspberry-wifi-conf
> node server.js


Wifi is not enabled, Enabling AP for self-configure

Force reconfigure enabled - reset AP
... dhcp server restarted!
ifdown wlan0 successful...
ifup wlan0 successful...
... hostapd restarted!
... AP Enable Success!

HTTP server running...

@sabhiram
Copy link
Owner

sabhiram commented Oct 2, 2017

So those are all good looking statuses. Are you sure you do not see the config access point running?

Remember that if you run the sudo npm start command from a terminal - it will block and not return until the app is either killed, or it crashes (hopefully not). Can you check using another mobile device if you see the access point listed? And if you do - try connecting to it and visiting the IP that you specified in the config file.

@smallzZz8
Copy link
Author

Oh no I didn't say that I could not see the wireless point from my phone. I can indeed see it, but if I connect to it, and go to that IP it does not show up. Here are some screenshots from my phone of what I mean. You can see the pictures here, https://imgur.com/a/OLkKN . If you notice, once I am connected with my phone, you can not see the wifi bars at the top of the screen. And yes I have tried this on another device as well and it is the same thing.

Were you not able to recreate this scenario? If not then maybe its the new Pi's?

Also, Ill be on for the next 5 hours or so expect fast replies :D

@smallzZz8
Copy link
Author

If you would prefer to talk via skype and do a screen share, feel free to add me at smallzZz8.

@sabhiram
Copy link
Owner

sabhiram commented Oct 3, 2017

It seems like our github-timezones do not agree with each other. I am sorry I missed you. Lets chat on skype.

@smallzZz8
Copy link
Author

I do not see a request? Ill added a user named sabhiram. If thats you accept. If not whats your username?

@smallzZz8
Copy link
Author

Again ill probably be here for the next 5 hours or so.

@shawnipoo
Copy link

I'll hop in on this if we can get it working.... @sabhiram , any luck with a fresh and latest Raspbian install? Thanks in advance!

@smallzZz8
Copy link
Author

@sabhiram Thoughts on my previous comment?

Oh no I didn't say that I could not see the wireless point from my phone. I can indeed see it, but if I connect to it, and go to that IP it does not show up. Here are some screenshots from my phone of what I mean. You can see the pictures here, https://imgur.com/a/OLkKN . If you notice, once I am connected with my phone, you can not see the wifi bars at the top of the screen. And yes I have tried this on another device as well and it is the same thing.

Were you not able to recreate this scenario? If not then maybe its the new Pi's?

Also, Ill be on for the next 5 hours or so expect fast replies :D

@sabhiram
Copy link
Owner

sabhiram commented Oct 5, 2017

That tells me that the DHCP server is not doing what we think it should be (unless the HTTP server is not working either...).

Let me check once I find time w/ a raspberry pi 3 and report back. Been very busy lately.

@smallzZz8
Copy link
Author

Okay well I will be waiting here for a request. Trying to get this working before I continue the rest of my project. Thanks again man!

@smallzZz8
Copy link
Author

@sabhiram Any luck yet?

@shawnipoo
Copy link

@sabhiram Note that it does the same thing with a Pi0W. I think it's related to Raspbian, not necessarily hardware...

@smallzZz8
Copy link
Author

smallzZz8 commented Oct 14, 2017

I actually disagree. I tried to install with an older version of raspian and it still did not work. I think it has to do with all RPi 3's especially since the project was built in 2017. It sucks to know that it doesn't work on the pi zero though because I just ordered one yesterday hoping that it would work. Hopefully @sabhiram will find a solution soon.

@smallzZz8
Copy link
Author

smallzZz8 commented Oct 15, 2017

Well my Rpi Zero W came in today and I did the same steps as listed above and got the same results. It appears to be an issue for all Rpi 3s.

Unfortunately I do not know how to fix this problem and would greatly appreciate anyone's efforts to try to fix it as this as I need it for something that I am working on. As for @sabhiram if you are unable to find your Rpi 3 i would be willing to send you a new one if your able to look at this code again.

@adyscorpius
Copy link

I am facing the same issue.. Followed the steps, the script seems to run, but it won't create a wifi AP..

@sabhiram
Copy link
Owner

Ok, seems like a lot of folk are trying to get this thing to work on a Pi3.

I apologize for how long this has taken me, but I went from closing up my startup of 2.5 years to trying to get going on another one, so my time has been sparse.

I will do my best to give this a shot this week as I should be less busy around Easter. Thanks for your comments, I hope to help resolve them. I have a Pi3 somewhere, so that should not be an issue.

@sabhiram
Copy link
Owner

At my home raspberryPi 3b - I was able to get to the point where it said "HTTP Server started" and I observed that the AP was not visible. I manually rebooted the server with sudo npm start and this time - saw that the HTTP server was up.

To debug you can enable the force_reconfigure option in the config file.

Would appreciate if someone else can confirm the same.

@sabhiram
Copy link
Owner

There has recently been a bunch of work done in #33 which should make things a bit nicer on a Pi3. If people are still having issues, that branch might be useful - will merge it once I test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants