1

Operating system: I use a Raspbian derivate called openhabian.

I had the following configuration wpa_supplicant.conf:

network={
        ssid="NEW"
        key_mgmt=NONE
}

network={
        ssid="OLD"
        key_mgmt=NONE
}

My /etc/network/interfaces:

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

Because the RPi connected to the OLD network and I want it to connect to the NEW network I added a priority:

network={
        ssid="NEW"
        key_mgmt=NONE
        priority=2 
}

network={
        ssid="OLD"
        key_mgmt=NONE
        priority=1
}

~$  wpa_cli list_networks 
Selected interface 'p2p-dev-wlan0'
network id / ssid / bssid / flags
0   NEW any 
1   OLD any 
~$ wpa_cli select_network 0
Selected interface 'p2p-dev-wlan0'
OK
~$ reboot

After this it does not connect to any network. I can't access the RPi anymore but I want to know why at least. I were very sure that I do not lock out because it has still the OLD network and it would be safe to add the priority. Maybe I just have to wait until it connects to the "fallback" OLD network? Does the wpa_cli select_network 0 write any persistent configuration?

Fabian
  • 1,260
  • 1
  • 10
  • 19
No3x
  • 111
  • 1
  • 3
  • I guess you are using Raspbian. Can you please add a tag for this? Does the NEW network ever works? For testing have you tried a wpa_supplicant.conf only with the NEW network block? – Ingo Mar 26 '18 at 11:57
  • 1
    @Ingo I use a Raspbian derivate called openhabian. After I locked myself out I edited the rootfs and removed the old network - after this it connected to the network - so yes the NEW network works. – No3x Mar 26 '18 at 13:46
  • That is what you want, isn't it? – Ingo Mar 26 '18 at 15:57
  • Yes! But I want to know why I locked out just by adding the priority so the next time I can prevent this. – No3x Mar 26 '18 at 19:38
  • Ahh yes, OK - Sorry. I've looked a little bit and found this duplicate How to set WiFi network priority?. But it doesn't give a solution. They tell what you expect. Maybe it is an issue with the signal strength? – Ingo Mar 26 '18 at 20:56
  • Both signals are quite good. I can do a wifi scan to provide details. But I would expect that it connects to at least one network. – No3x Mar 27 '18 at 08:17

1 Answers1

3

Why your Raspberry Pi was not able to reconnect after reboot is really hard to tell from the information provided.

However, I am pretty sure that

wpa_cli select_network 0

did not work as you intended, as I can see that the WiFi-direct interface p2p-dev-wlan0 was used (this interface is selected as default, if you call wpa_cli on raspbian stretch). In my experience, you should specify the Interface (assuming that wlan0 is your regular wireless Interface, you want to use to connect to the Access point):

wpa_cli -i wlan0 select_network 0

Then manual switching between networks normally works without problems and without the need to reboot.

oh.dae.su
  • 934
  • 1
  • 5
  • 12