0

I'm working with a raspberry pi 3 running a fresh install Raspbian Stretch Lite. Basically my problem is that the pi inconsistently connects to our network. I've been running

sudo ifdown wlan0; sudo ifup wlan0

over and over again and have found that 3 different things happen.

1

I see the following line near the end of the output (ip addresses changed):

DHCPACK of 192.168.99.120 from 192.168.99.254

That's the ip that I'm used to seeing for the pi and the router. The pi can access the internet, and I can ssh into it.

2

I see the following line near the end of the output:

DHCPACK of 192.168.1.106 from 192.168.1.1

The ip address for the pi and the router are different than usual. The pi seems to be connected to the network, but I cannot ping the router or anything else, and I cannot ssh into it.

3

wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpa/supplicant exited with return code 1
ifup: failed to bring up wlan0

Obviously, no internet, no ssh.

It seems that the wpa_supplicant fails to start about half of the time, and if it does connect it's 50/50 on which ip addresses I'll see for the pi and the router. If the pi is connected to the wifi network properly it will stay connected for days or weeks without any trouble, so I don't think it's problem with the pi's wifi chip.

I haven't been able to find a record of anything like this, but I do know that our network is known to give some devices trouble. Does anyone have any idea what the problem or at least have some advice on how to live with it.

/etc/network/interfaces auto lo iface lo inet loopback iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

/etc/wpa_supplicant/wpa_supplicant.conf

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="myNetwork"
        psk="reallyGoodPassword"
}
0

I really don't know why people fiddle with the configuration files, particularly when they follow obsolete instructions, which incidentally would NEVER have worked reliably. Perhaps you should include the link you followed, so others could be warned.

The following describes the correct contents of the interfaces file, and has instructions for configuring networks.

How do I set up networking/WiFi/Static IP

  • I don't think the ip address issue has anything to do with the pi's configuration, and I believe the issue with the wpa_supplicant daemon failing to start is from doing ifdown and immediately running ifup. I was able to get another pi running stretch lite on a stable network to throw the same error by running sudo ifdown wlan0; sudo ifup wlan0 – C.J. Hatch Oct 26 '17 at 14:23
  • @C.J.Hatch These commands are obsolete. If you really want to use Debian networking, I could explain the correct settings. However I suggest you try the current Raspbian configuration, which is more robust, and what most of us use. – Milliways Oct 26 '17 at 22:59
  • I definitely want to learn things the right way. I know some things changed, but I haven't found a definitive guide to setting wifi up from the terminal in stretch lite. – C.J. Hatch Oct 27 '17 at 14:31
  • @C.J.Hatch In fact I think the link in my answer is "a definitive guide" which includes If you are using WiFi from the Command Line set up by following the Foundation Guidelines If you just deleted /etc/network/interfaces your system would work better (the current configuration effectively does NOTHING). – Milliways Oct 27 '17 at 22:44
  • Ok, I was confused because I thought that there was a different file to modify other than /etc/network/interfaces, but it seems that I can just work with wpa_supplicant.conf. It is worth noting that ifdown/ifup will not work without /etc/network/interfaces and that ip link set dev up/down should be used instead. – C.J. Hatch Oct 31 '17 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.