Configure WiFi from outside

Having issues with your DietPi installation, or, found a bug? Post it here.
dietpiOK
Posts: 76
Joined: Thu Mar 16, 2017 9:33 am

Configure WiFi from outside

Post by dietpiOK »

Hi!

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,
Olaf
User avatar
MichaIng
Site Admin
Posts: 2260
Joined: Sat Nov 18, 2017 6:21 pm

Re: Configure WiFi from outside

Post by MichaIng »

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: https://github.com/Fourdee/DietPi/issues/368
dietpiOK
Posts: 76
Joined: Thu Mar 16, 2017 9:33 am

Re: Configure WiFi from outside

Post by dietpiOK »

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,
Olaf
User avatar
MichaIng
Site Admin
Posts: 2260
Joined: Sat Nov 18, 2017 6:21 pm

Re: Configure WiFi from outside

Post by MichaIng »

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 :).

No idea if/how well MacOS/iOS supports ext4. Also worth to try if the above doesn't work out.
dietpiOK
Posts: 76
Joined: Thu Mar 16, 2017 9:33 am

Re: Configure WiFi from outside

Post by dietpiOK »

Ok, I will check if the modification to the dietpi.txt regarding the wait time will work, later.
I'll keep you posted...
dietpiOK
Posts: 76
Joined: Thu Mar 16, 2017 9:33 am

Re: Configure WiFi from outside

Post by dietpiOK »

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!
User avatar
WarHawk
Posts: 606
Joined: Thu Jul 20, 2017 8:55 am

Re: Configure WiFi from outside

Post by WarHawk »

Can you pull the card and put into another linux machine

Edit
/etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

country=GB 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="Your SSID"
    psk="YourWPAPassword"
    key_mgmt=WPA-PSK
}
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

Code: Select all

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)
User avatar
MichaIng
Site Admin
Posts: 2260
Joined: Sat Nov 18, 2017 6:21 pm

Re: Configure WiFi from outside

Post by MichaIng »

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.
HiKE_yt
Posts: 1
Joined: Mon May 18, 2020 10:43 am

Re: Configure WiFi from outside

Post by HiKE_yt »

Hi,

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

Thanks
User avatar
Joulinar
Posts: 2020
Joined: Sat Nov 16, 2019 12:49 am

Re: Configure WiFi from outside

Post by Joulinar »

Hi,

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

To connect to WiFi, you can use dietpi-config tool
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply