Wireless Password being overwritten by System password

I have tracked down why my Pi3 will connect to my WiFi OK to start with then stops working. (see also “After first reboot, cant access musicbox.local”).

After the SD image is written one edits the “settings” file to include the SSID and WiFi password for the Local LAN.

# --------------------
# | Network Settings |
# --------------------
[network]
# Settings for your WiFi network, if you use a (supported) wifi-dongle
# Only supports WPA security, no WEP or access points without security (dive into the command line for that!)
wifi_network = XXXX Wireless LAN
wifi_password = xxxxxxxxxx

This works fine and the Pi connects fine and will continue to do so boot after boot.

At the same time one can set a new Pi system password:

# ---------------------
# | MusicBox Settings |
# ---------------------
[musicbox]
# To secure your device, change the default password to something else.
# For security, the value in this file will be automatically cleaned out when the password is set in MusicBox
root_password = BBBBBBB
----------------------------------------------------------

This too works fine and you can log into the Pi console using ID = root, PW = BBBBBBB

AND the clear text
root_password = BBBBBBB
is converted to
root_password = ""
in the settings file (for security).

This works fine and the Pi connects fine and will continue to do so boot after boot.

However, If you use the Web interface and say turn on SSH using it, then save and reboot,
When it reboots the Pi will no longer connect to WiFi.

When I looked at the settings file I noticed that the WiFi password “xxxxxxxxxx” had been replaced by the system password “BBBBBBB” in this file

# --------------------
# | Network Settings |
# --------------------
[network]
# Settings for your WiFi network, if you use a (supported) wifi-dongle
# Only supports WPA security, no WEP or access points without security (dive into the command line for that!)
wifi_network = XXXX Wireless LAN
wifi_password = BBBBBBB

Obviously after this the system will no longer connect to the LAN.

The problem seems to happen whenever you use the web interface to change the system settings.

Hope this helps and that you will be able to fix it.

F.

Thanks very much, it’s very helpful when you have detailed steps to reproduce an issue like this. I’m sure the bug will be obvious now.

p.s. I hope you don’t mind but I edited your post to include code sections so that I could read it more easily.

Having said that, I just had a quick look at the code and still can’t see what’s going wrong. Once the system password BBBBBBB is replaced with “” it’s gone and there’s No Way that BBBBBBB can end up in the wifi_password in some future boot. The data is gone. I’ll have to try these exact steps on the real thing and see what I am missing.

Hi,

Yes the BBBBB does go.

BUT

Even after a reboot (after it has gone), it comes back and replaces the
WiFi password.

I wondered about that too😕

Fred