0

I'm pulling my hairs out over what should be a simple network switch. I moved into a new home and we got a new router. To switch my Pis I booted up my old router, connected to the Pis (one 0W and a 3B+) via ssh and used raspi-config to change the wifi networks. Nothing seemed to have changed upon reboot. They still connected to the old network. Then I changed /etc/wpa_supplicant/wpa_supplicant to

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<My Country>

network={
 ssid="<my new SSID>"
 psk="<psk pw>"
}

and rebooted. Nothing happened, raspi boots into old network as if nothing changed.

The I looked at wpa_cli list_networks and got this error:

Selected interface 'p2p-dev-wlan0'

Interactive mode

Could not connect to wpa_supplicant: p2p-dev-wlan0

so i added

p2p_disabled=1

to the wpa_supplicant and could check that indeed everything got ignored, the only network listed was my old one.

I then added a prioritized second network to the wpa_supplicant.conf that, you guessed it, got ignored. I played around with different values (i understand that Priority has a 1-100 range) because i really haven't rebooted the Pi enough at this point.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<My Country>

network={
 ssid="<my new SSID>"
 psk="<psk pw>"
 Priority=2
}
network={
 ssid="<my old SSID>"
 psk="<psk pw>"
 Priority=1
}

From here i am stumped. Then I remembered that I set those Pis up headless by creating the ssh and wpa_supplicant.conf files and put the new one into /media/boot in the hope it gets transfered over the same way as the first time. No change. I did the same with mounting the SD-Card on a Desktop and saved it. Nada. Is there anything i missed, where does it get the info from if not from wpa_supplicant.conf? It's Debian Buster on both boxes if that helps. edit: the output of _ps aux | grep wpa_supplicant_

root       298  0.0  0.4  11004  4640 ?        Ss   Mar08   0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
pi       14786  0.0  0.0   7480   528 pts/0    S+   08:43   0:00 grep --color=auto wpa_supplicant

UPDATE with info from comment:
About nm: I too am surprised how nm got into the mix here. The 3B+ is running homeassistant and the installation might have switched to network manager transparent to me. But for the Pi0W i am sure, because that thing is a pure raspbian buster testbed that i occasionally use just to run some python scripts. I didn't even know about network manager before. Unless buster does some translating of the wpa_supplicant.conf i can't imagine how that would work.

Ingo
  • 40,606
  • 15
  • 76
  • 189
  • I'm voting to close this question as off-topic because the user has been deleted. – M. Rostami Mar 07 '20 at 21:43
  • If you want help you need to provide some details including Raspbian version Pi model and any files you modified. See [How to set up networking/WiFi](https://raspberrypi.stackexchange.com/a/37921/8697) PS don't be so coy about listing EXACT settings (password excepted). – Milliways Mar 07 '20 at 22:35
  • @Milliways: All that info is in my post, I didn't change files other than the ones described. For reference (Pi3b+, Pi 0 w, both on raspbian buster) –  Mar 07 '20 at 23:20
  • what is `/media/boot` ?? why can't you just edit `/etc/wpa_supplicant/wpa_supplicant.conf` directly since you can run commands like `wpa_cli` - also in my wpa_supplicant file I have `key_mgmt=WPA-PSK` and `scan_ssid=1` in the network config - the latter is required if your AP doesn't broadcast SSID – Jaromanda X Mar 08 '20 at 00:58
  • Please edit your question and add the output of this command to it: `ps aux | grep wpa_supplicant`. – Ingo Mar 08 '20 at 08:21

1 Answers1

2

It is very difficult to get an overview what you have installed and setup on your RasPis with the information you give us only step by step. You have NetworkManager installed where you don't know how it comes. NetworkManager is not supported by Raspbian and it is known that it conflicts with the default network setup if you don't know what you are doing. There is a home assistant running we don't know what it is doing. You are careless fiddling with setups, e.g. disabling p2p-dev-wlan0 with no reason. This is the first device wpa_cli uses by default. Usually you have to specify the interface you want to manage, e.g. wpa_cli -i wlan0. Then with ps aux | grep wpa_supplicant you show us the situation when wpa_supplicant is loaded but has no connection. If restarting from scratch with a fresh flashed Raspbian image is only the last option, you can try following:

Enable p2p-dev-wlan0 again.

Establish a connection with wpa_supplicant to your remote hotspot. The examples here are what I get on my RasPi with default Raspbian Buster Lite. Check if you have a connection with:

rpi ~$ $ iw dev wlan0 info
Interface wlan0
        ifindex 3
        wdev 0x1
        addr dc:a6:32:a1:d7:ed
        ssid TestNet
        type managed
        wiphy 0
        channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
        txpower 31.00 dBm

Then execute:

rpi ~$ ps aux | grep wpa_supplicant
root       499  0.0  0.2  10740  4012 ?        Ss   10:25   0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
root       551  0.0  0.2  11120  4160 ?        Ss   10:25   0:00 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
pi         772  0.0  0.0   7348   568 ttyS0    S+   10:28   0:00 grep --color=auto wpa_supplicant

As you can see it tells you what config file wpa_supplicant uses so you can find it.

Then disable NetworkManger completely with:

rpi ~$ sudo systemctl mask network-manager.service

Reboot and look what new error messages do you get with:

rpi ~$ journalctl -b -e

and fix them. With problems you can comment to this answer.

Ingo
  • 40,606
  • 15
  • 76
  • 189