OpenEnergyMonitor Community

Using wpa_supplicant.conf file on the emonSD boot partition


I am very interested in wpa_supplicant boot option because we can change very fast the configuration without change any cable, only dismounting SD and changing in a minute wpa_supplicant file in boot (I can do it by windows too).

I am trying to do it but I can not achieve, any recommendation?


[moved from emonPi SD Card Build as thread has been quiet for 18mths and this is relevant to any emonSD]

The method you refer to is unlikely to work on the emonSD as the OS is read-only.

The Raspian feature of reading the wpa_supplicant.conf file from the boot partition at start up and using it to overwrite the pre-existing one at /etc/wpa_supplicant/wpa_supplicant.conf will fail as the target is not writable.

Thanks Paul!

Is it possible to write etc file from windows?

Or do the configuration of WIFI in some way using WIndows and only the SD card?

Perhaps Cygwin or a similar utility that allows you to access Linux partitions from windows, it you have another Linux device it may be easier to plug your card reader and sdcard into that to do it.

Actually there is a way to to set up the emonPi to allow editing in windows if you still have access to the emonPi now.

Add a file with the contents of your wpa_supplicant.conf in it, I recommend using a different file name to steer clear of the Raspbian feature (in case it deletes it) eg “wifi.conf”, and symlinking that file to where the file is currently would work.

sudo mv /etc/wpa_supplicant/wpa_supplicant.conf /boot/wifi.conf
sudo ln -s /boot/wifi.conf /etc/wpa_supplicant/wpa_supplicant.conf

This puts the file where it can be edited by a windoz box, do not delete it, just edit it, it will be used from there and not copied into place.

Could be easier a Virtual box with a linux distribution?


i understand this, but I am using Raspberry PI zero and I am thinking in First boot without Ethernet.

Now I start the process with a Raspberry 2 with ethernet and then I move the SD to a Raspberry PI zero, I am trying to configure Wifi user and password before frist boot.

I am working with Virutal Box Ubuntu, I think nowadays there is not another solution.

Thank you Paul

Ah, yes. That is a weakness of the current emonSD.

I would certainly expect so, but I have no experience with using Virtual Box.

How many first boots are you anticipating? For one or two, accessing the image to edit via a linux OS (or utility) is going to be ok.

If you are deloying lots of Pi zero’s or expacting to reinstall often, you could do my suggested move and symlink to one image using the Pi2 and create your own image for deploying to ther devices with an editable /boot/wifi.conf.

Or why not just keep a standard Raspbian SDcard for use in the Pi2 and plug your emonSD cards into that with a card reader for editing?

I am using

I am accesing to Linux partition without any problem.

Any of the other solutions you provied are more complicated for me.

I think the best option is to make this with a Pure Linux Distribution in a laptop (not a virtualbox). Virtualbox is a bit hard because I have to create a raw partition to access SD and I must do it manually and one by one.

I am very interested in this solution. Can you explain me better? I do not understand symlink and I do not understand the process in general.

Thank you very much Paul

Hi again:

Finally it is difficult to solve the Read only system problem using only Windows.

I could do the change or wifi ssid and password doing that:

1- Virtual box installation UBUNTU
2- Create a Raw SATA HDD referencing SD (PHYSICAL DRIVE 2 in my case). VirtualBox direct access to SD Card in Windows – Sandy Scott's Web Spot
3- In Ubuntu terminal.
sudo chmod 777 -R ‘folder to change’
4- Change network/interfaces configuration

I would like to do easily. Any recomendation to change read-only permisson faster or any solution with less steps.


I am thinking one thing?

Is it there any problem if I “open” the permissons to etc/network folder and I am able to change interfaces with Notepad ++ in Windows directly using Ext2fsd application

Is it any security inconvenient?

Any other option?


If I open the permissons for wpa_configuration folder Will copy/paste boot partition wpa_configuration file to the raspberry?

I will test it now, I will report in a while.

I need to take a closer look at this as I had forgotten that the emonSD images wpa_supplicant file is already symlinked and placed on the writable /data partition. This may play havoc on trying to edit the file whilst it is mounted on another host OS, either VM or Linux box etc.

The emonSD image is altered this way so that the wifi page from emoncms can edit the wifi details.

I think symlinking the file from /boot to /data might be easiest, I will need to study the emonpi fs again and give it a try to be sure.

This is for me the best option.

Efectively wpa_supplicant is the configuration file and it is moved by symlink according to the emonSD guidelines to home/pi

I do not know how to change boot script. How can I do it? Any tutorial or something?


Unfortunately it might not be that straight forward because of the way the emoncms wifi config module, the read-only filesystem and the windows compatible boot partition work.

In theory you could move and symlink the ~/data/wpa_supplicant.conf file to the /boot partition so that everyone can find it and you can edit it in windows, however from the Raspbian OS, only root can write to the /boot partition, so the emoncms module may fail to write to the symlinked file on the /boot partition. You could try it I guess…

sudo mv /home/pi/data/wpa_supplicant.conf /boot/wifi.conf
sudo ln -s /boot/wifi.conf /home/pi/data/wpa_supplicant.conf

…actually, having just checked the file location I can see the wpa_supplicant file is already owned by root:root so it should work…

let us know…

It’s easy using Linux, just pop the SD card out of the RasPi and into your computer than edit ~/data/wpa_supplicant.conf .

On windows it should be quite straightforward to use something mount the ext file system using one of them methods mentioned below:

Or just use a linux VM.

Moving the file to the /boot partition is an option but I would do this with caution as it may cause unintended consequences and cause issues with future updates.

OK, the right address is /data/wpa_supplicant.conf

I prefer to edit it via Virtual Box UBUNTU, When I use ExtFsd or other Pure Windows Tools I can not write because it is a Only-Read Partition.
How I can fix it using only windows? I can not change this without open Windows

Is it /data/wpa_supplicant.conf a writtable folder?

Thanks Glyn

It maybe when using a windows utility…

The correct address when mounted on the emonSD’d OS is /home/pi/data/wpa_supplicant.conf Glyn’s reference of~/data/wpa_supplicant.conf uses “~” which is a linux shortcut for “the current users home/root directory” which only when accessed via the emonSD by user pi will be /home/pi.

Since the 3rd partition is mounted as /home/pi/data that is the most accurate path whilst mounted ie via the emonSD OS.

data is an ext2 linux partition, when using a “windows reader utility” to read the linux partition, it is not writable. However it is writable when mounted in a linux OS. The windows readers tend to make a copy of the file that windows can read, in which case any edits will be to a windows only copy file and not to the original linux file, so no change when you put the card back in the emonpi.

The ONLY way of doing it with “windows only” is to put the file on the vfat formatted boot partition, it is the only partition that is recognized by both linux and windows, that is the reason it exists.

This is always good advice, more so when editing the emonSD as it’s difficult to predict what may change. But since the wpa_supplicant.conf cannot be “just overwritten” by the emonpi updater deleting and replacing it without losing users wifi settings, it is unlikely this move will prevent future updates. The one time I would predict trouble would be IF the OS was writable and a wpa_supplicant.conf file was accidentally added to the boot partition before a reboot, since the OS is RO and this function doesn’t work, this is unlikely to happen.

Any move from “stock” emonSD could comeback and bite you. But it is the only way to do this without a 2nd linux OS (VM or Pi etc) AFAICT.

1 Like

So, finally the best options are:

1- Use Extfsd Windows aplication (it is able to write in writtable ext2 partitions). I like this option I will try it.

2- As Paul explain before make a symlink from data/wa_supplicant.conf to boot/wifi.conf. In this option I do not why you change the name of the file. I supouse you are preventing any problem copy/pasting a “wpa_supplicant.conf” file accidentaly as you explain.

I think I have more than enough solutions to do it very fast.