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).
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
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.
Issue
When multiple wireless interfaces are available, setting the wi-fi country removes the network credentials from
wpa_supplicant.conf
. This is because when usingwpa_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 bywpa_cli
(e.g.: one without network credentials in its configuration), any credentials inwpa_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