Configure WiFi from outside


I have to run my raspi on another wifi than currently configured inside my raspi.
Since I configured the raspi to wait for network during boot time I will have to apply the new WiFi configuration from the outside of my raspi by modifying the files on th sd card from my Windows machine.
Just editing the dietpi.txt obviously does not work (I assume that file is only being used at first-time boot of a new image, right?)
How can I apply a new WiFi config given the fact that the raspi will not boot to prompt?

Best regards,

Hi Olaf,

you are right that the WiFi settings within dietpi.txt are only applied on first run setup.

They are then added to /etc/network/interfaces, thus this is also the file you need too edit after first boot. At least the entries should be self explaining, but the problem is that Windows cannot natively access the ext4 file system.

You don’t have a chance to edit this from within the old WiFi or via direct keyboard + monitor attached?

Anther linux system would be the alternative or use an ext4 driver for Windows, but I never found one that works really reliably.

This issue supports an open topic on GitHub, to allow preconfiguring multiple WiFi SSIDs and let the system choose the first or available:

Thanks for your reply!

Unfortunately I do not have any chance to temporarily connect the raspi to the former WiFi. And since I configured it to wait for the network I cannot do anything from the console (or am I missing something…). During boot it says “Wainting for a valid connection, before continuing boot | Mode=2”.

One option that I see is that I can edit the file you mentiones from my MacBook. Any experience if this will work properly with ext4 file system?

Best regards,

If I am not wrong, the system does not wait forever for network, max 1 minute or something.
And you should be able to disable waiting for network within dietpi.txt as well, which is not just applied on first run setup.

But let me recheck this.
€: Jep, waits for max 10 seconds you can as well completely disable via dietpi.txt :slight_smile:.

No idea if/how well MacOS/iOS supports ext4. Also worth to try if the above doesn’t work out.

Ok, I will check if the modification to the dietpi.txt regarding the wait time will work, later.
I’ll keep you posted…

Switching to Mode 1 (wait for 10 seconds) works perfectly and logging in to the console either.
It’s quite hard to understand which config settings from the dietpi.txt will be processed only once and which at every boot…

Nevertheless thanks for your support!

Can you pull the card and put into another linux machine


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    ssid="Your SSID"

change country to the country you are in

Then type sync…eject the volume, then boot the pi

Also might need to add the line

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

To either the /etc/network/interfaces line in the wlan0 section (look for the entry for your wlan0)

Good hint that wpa_supplicant needs to be changed as well for the credentials.
The wpa-conf line at least is present by default within interface file, but yeah double check doesn’t hurt.

Great to hear that it worked now anyway on local console. So no manual adjustment needed anyway.
Jep makes sense so add info about with settings are applied just once and which lib every boot, or every time the related feature is outset respectively.


Is it possible to add a command to get/connect to wifi ?
Or it already exists ?



can you pls a little bit more specific on you request?

To connect to WiFi, you can use dietpi-config tool

Any solution to this. Use case is configuring and testing the pi on your network and then sending it to someone else so they can connect it to their network.

For me a simple solution would be if the SD card boots and detects the “dietpi-wifi.txt” file then it overwrites your config. This way we could manually re add it if we need to change it headless.

dietpi-wifi.txt is working during initial boot only. It can’t be used later on again.

Your use case would fit for this post

So the down side with this approach is the requirement on Linux. Most non-tech user are going to want Windows compatible solutions.

well you can connect to the device directly via a direct cable connection, login using SSH and configure WiFi