RPi-Distro / raspi-config

Configuration tool for the Raspberry Pi
Other
565 stars 206 forks source link

Setting wi-fi country cleans up wpa_supplicant.conf if multiple wireless interfaces are available #204

Closed jcapona closed 1 year ago

jcapona commented 1 year ago

Issue

When multiple wireless interfaces are available, setting the wi-fi country removes the network credentials from wpa_supplicant.conf. This is because when using wpa_cli without specifying an interface, wpa_cli chooses the first interface with a control socket in the socket path (According to this).

https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config#L623

https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config#L624

In some scenarios where a wireless interface not managed by wpa_supplicant is chosen by wpa_cli (e.g.: one without network credentials in its configuration), any credentials in wpa_supplicant.conf will be removed because the configuration from another interface is written in it; this means that on reboot, the Raspberry Pi won't connect to the wi-fi network users might have configured.

Proposal

Specify the wireless interface when using wpa_cli to set the wi-fi country

jcapona commented 1 year ago

Note that, at least on the last version of raspi-config, the post-install script runs this command after making some verifications. This means that on every update the wpa_supplicant.conf file might be affected.