Pre-configured WiFi Details failed (Rpi Zero w, DietPi v6.28.0)

First of all: Many thanks to all members, great work !
This problem is reproducible (for me):
Doing exactly the steps from “Getting started” (with the goal not to plug in keyboard / monitor and only to ssh into)

change dietpi.txt (WIFI only):

Open dietpi-wifi.txt on a WIN10 PC with wordpad (but in another try with notepad):
Change aWIFI_SSID[0]=‘MySSID’ and aWIFI_KEY[0]=‘MyWifiKey’
of course with my own SSID / Key :wink:
and so on …
Finaly I’ve plugged in SD card, to have a nice time while dietpi and Rpi0 were both working very hard.
But after a while there was no ping (and putty can’t login) and router doesn’t show anything new.

Not amused I search another keyboard and another monitor and take a look at console.
ok. I found in dietpi-wifi.db:
SSID as well as the WLAN Key both were corrupted by an ending carriage return.
I reset SSID and WLAN key with dietpi-config manually and finally Rpi0 was connected to my WLAN.

Doing some research on dietpi/func/dietpi-wifidb and shrinking the bash script to seven lines for testing:
. ./oo
cat << EOF | od -bc

run this with an also shrinked dietpi-wifi.txt named oo
(simulating partially bash script dietpi-wifidb on it’s first run):

0000000 141 127 111 106 111 137 123 123 111 104 133 060 135 075 047 166
a W I F I _ S S I D [ 0 ] = ’ v
0000020 145 162 171 123 145 143 162 145 164 120 141 163 163 167 157 162
e r y S e c r e t P a s s w o r
0000040 144 015 047 012
d \r ’ \n
( od -bc oo shows no \r inside the plain text of oo )

Same with aWIFI_KEY[].

Hey DietPi, I’ve a verySecretPassword but there is no carriage return at the end at all :wink:
So a workaround for me could be to kill first all carriage returns from my dietpi-wifi.txt before
transfering my new sd card to the Rpi0 and before taking a cup of coffee.
But perhaps it’s a bug in dietpi/func/dietpi-wifidb in the bash pattern substitution construction (above).

Did I already mentioned: many thanks to all in the team, great work !


that sounds strange. Today I was testing the initial WiFi setup on my RPi3B+ without issues. I just flashed a new image, enabled WiFi on dietpi.txt + adding my WiFI credentials in dietpi-wifi.txt and all was working out of the box.

On my RPi Zero W the pre-configured Wifi refuses to connect.

So I put the SD card in my RPi4, waited for the install to start and then put the SD card back in the Zero. That’s the only way I get the Wifi to connect.