Enable and add wifi AP from filesystem

Hello everyone!

I’ve been using DietPi on my RPI4 only with ethernet and therefore disabled the wifi module. I brought it with me somewhere else but I don’t have an ethernet cable and wanted to reactivate the wifi module and add an AP. I have access to the root filesystem on my Linux machine easily, and been toying with network/interfaces file and wpa_supplicant.conf, to no avail.

Here is my /etc/network/interfaces file:

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Local
auto lo
iface lo inet loopback

# Ethernet
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.1.28
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 192.168.1.1

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.1.27
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 192.168.1.1
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

My /etc/wpa_supplicant/wpa_supplicant.conf:

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="my_ssid"
scan_ssid=1
key_mgmt=WPA-PSK
psk="my_pass"
}

I tried setting “wireless-power on” and uncommenting the allow-hotplug command. After different tries, I’ve came to the conclusion that wifi is disabled somewhere else.

How can I enable the wifi and add an AP by just accessing the filesystem? Thanks!

Hi,

did you tried to go to dietpi-config and active the WiFi device?

Thanks for your answer! I forgot to add, I can’t use the RPI because I don’t have a screen. :frowning:

hi,

this all is working headless. So you can run dietpi-config within a SSH session :wink:

But I can’t access it by SSH as I don’t have an ethernet cable and it isn’t connected to the wifi. Or is there another solution to SSH into it? :slight_smile:

So you removed the SD card from you Pi and plug it into your computer. And than try to change config files to enable WiFi?

One question: what is the target you are trying to achieve? I mean even if you will get Wifi working, you will not be able to install the hotspot components like DHCP server or hotspots without internet connection. Next to that, are you sure you still have WiFi packages on your system? Because there is an option to purge WiFi packages if you disable the adapter on dietpi-config.

That’s what I did. But you’re making a good point, there is a possibility that those packages are uninstalled. Guess I’ll go find an ethernet cable and reactivate the wifi via SSH. Thanks!

if the WiFi packages are purged, you would need internet connection to get them back

No problem, I just went home due to the virus and thought I had an ethernet cable available. But i just used temporarily the one from the home computer to reenable all wifi modules. Thanks for your help!

ok than it was an easy fix :wink: