I am trying to provide wifi details to raspberry pi though Bluetooth.
We are adding the wifi credentials to /etc/wpa_supplicant/wpa_supplicant.conf file.
Once I get the credentials I am using nodejs to update the wifi credentials using fs.write(). I am completely overwriting the file. I am providing all the details needed in the file.
But I am getting the following error :
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to bring up wlan0.
But when open the file in nano/vim I see that the file is getting written correctly. Am i missing something? My guess is that it might be the format in which I am writing.
I have an other question: What will happen if I keep on appending the file with the wifi credentials, instead of overwriting it?
Any help is greatly appreciated?