How to modify wpa_supplicant.conf I would like to modify the wpa_supplicant.conf file. However if I do it, the file sets itself back to its previous version (even if I modify the file with one single character), and I have no idea where that sort of backup is stored nor if what I'm doing wrong.

I have tried to modify the file by copying it to a W7 PC and using notepad++, also with an SSH app with root rights granted. Same result. (have done the chown wifi:wifi thing too)

The system is a LineageOS with Android 7.1.2.

Disable wi-fi →modify file → re-enable wi-fi and also reverse.
The reason is that Android uses it's own management classes to read/write wpa_supplicant.conf in conjunction with networkHistory.txt file.

The WifiConfigStore in the Android framework does not write entries in wpa_supplicant if not found in networkHistory.txt

I've had success by first adding the network in networkHistory.txt before adding the network via wpa_cli.

However, in general, the usage of wpa_cli in Android is broken by the behavior of WifiConfigStore.