need help configuring wifi after first boot

hello everyone, this is my first time configuring DietPi, I have a question for how to configure wifi after first boot. Initially, I looked at this post “Setting up WiFi over SSH, without using DietPi-config” post for advice, but after some steps I didn’t follow through.
https://dietpi.com/forum/t/setting-up-wifi-over-ssh-without-using-dietpi-config/287/1

/etc/network/interfaces



# Wifi
auto wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid MyWiFiRouter
wireless-key MyWiFiKey
wireless-mode Managed
wireless-power off
wpa-ssid MyWiFiRouter
wpa-psk MyWiFiKey
#dns-nameservers 8.8.8.8 8.8.4.4

but the results I get after doing

ifup wlan0

was

wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
ifup: failed to bring up wlan0

I wonder how could I proceed?

I am using RPi 3B+ and DietPi v6.19.7

thank you!

I tried to edit the /sbin/wpa_supplicant file, but it’s unreadable (attached screenshot)

and I also tried to find the dietpi-wifi.txt file under /boot, entered router and password I do, and rebooted, still getting same error.

onebigear
Why do you want to not use dietpi-config? This is the easiest and failsafe method to configure WiFi after first boot.
/boot/dietpi-wifi.txt is only used ON first boot, so is only applied if you want/need to configure WiFi before booting up the first time, e.g. WiFi-only devices and such. It does not have any effect afterwards.

The way you configured /etc/network/interfaces contains some mixed wpa_supplicant + non-wpa_supplicant statements, which makes it fail most likely. DietPi-Config will separate connection and authentication settings, so all wpa_supplicant related (SSID, key, etc) is moved into a separate wpa_supplicant.conf. That keeps things cleaner and avoids incompatible syntax.

So in short, use dietpi-config, disable Ethernet, enable WiFi and configure it according to your needs :slight_smile:.


/sbin/wpa_supplicant is a binary file, no text file, which is why you see the cryptic binary chars :wink:. The binary is not the issue, but as mentioned above the settings you applied to it via /etc/network/interfaces.

You should use diet-config, disable Ethernet, enable WiFi and configure it as per your needs. It is the best way to configure WiFi after first boot.
/boot/dietpi-wifi.txt will be used in the first boot; it may be applied only when it is required to configure WiFi before booting up the first time. WiFi-only devices don’t have any effect afterward.
You may as configured /etc/network/interfaces contain mixed wpa_supplicant+non-wpa_supplicant statements, which makes it fail most likely. dietpi-config, it separate connection and authentication settings, then all wpa_supplicant, that related is moved into a separate wpa_supplicant.conf.That keeps things cleaner and avoids incompatible syntax.

ADMIN EDIT: Removed embedded spam link. If this required a second time, this account will be removed!