Apologies the wording: I used this dongle in past on Pi 5 with Kali. Never used it on Pi 4 and now I’m testing it on DietPi installed on Pi 4.
Not needed, the iface wlan1 ..
is all that is needed for ifup
to know the interface. We then use allow-hotplug
instead of auto
to bring up interfaces on device detection instead of fixed boot order position.
@XRay437 can you check whether interfaces.d/*
config file import is actually present in /etc/network/interfaces
?
Hello @MichaIng, yes it’s present:
root@DietPi:~# ^C
root@DietPi:~# cat /etc/network/interfaces
# 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/*
# Ethernet
#allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.1.99 172.31.0.2
# WiFi
allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.1.8
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 192.168.1.99 172.31.0.2
pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
root@DietPi:~# cat /etc/network/interfaces/*
cat: '/etc/network/interfaces/*': Not a directory
root@DietPi:~# cat /etc/network/interfaces.d/
cat: /etc/network/interfaces.d/: Is a directory
root@DietPi:~# cat /etc/network/interfaces.d/wlan1
# WiFi-USB
auto wlan1
allow-hotplug wlan1
iface wlan1 inet dhcp
#dns-nameservers 192.168.1.99 172.31.0.2
pre-up iw dev wlan1 set power_save off
post-down iw dev wlan1 set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Okay, please try to remove again either the auto wlan1
or allow-hotplug wlan1
, as AFAIK only one of them can or should be present. Then try whether it is listed with one of these commands:
ifquery -l --allow=hotplug
ifquery -l
ifquery -l --allow=hotplug -i /etc/network/interfaces.d/wlan1
ifquery -l -i /etc/network/interfaces.d/wlan1
With --allow=hotplug
it should list allow-hotplug
interfaces only, else auto
ones. The second set to verify whether the sourcing for whatever reason does not work, defining that config file explicitly.
I commented auto, keeping allow-hot plug only.
root@DietPi:~# ifquery -l --allow=hotplug;
ifquery -l;
ifquery -l --allow=hotplug -i /etc/network/interfaces.d/wlan1;
ifquery -l -i /etc/network/interfaces.d/wlan1
wlan0
error: main exception: no ifaces found matching given allow lists
error: /etc/network/interfaces.d/wlan1: line6: error processing line 'pre-up iw dev wlan1 set power_save off'
error: /etc/network/interfaces.d/wlan1: line7: error processing line 'post-down iw dev wlan1 set power_save on'
error: /etc/network/interfaces.d/wlan1: line8: error processing line 'wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf'
error: main exception: no ifaces found matching given allow lists
error: /etc/network/interfaces.d/wlan1: line6: error processing line 'pre-up iw dev wlan1 set power_save off'
error: /etc/network/interfaces.d/wlan1: line7: error processing line 'post-down iw dev wlan1 set power_save on'
error: /etc/network/interfaces.d/wlan1: line8: error processing line 'wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf'
error: main exception: no ifaces found matching given allow lists
root@DietPi:~# ifquery -l -i /etc/network/interfaces.d/wlan1
error: /etc/network/interfaces.d/wlan1: line6: error processing line 'pre-up iw dev wlan1 set power_save off'
error: /etc/network/interfaces.d/wlan1: line7: error processing line 'post-down iw dev wlan1 set power_save on'
error: /etc/network/interfaces.d/wlan1: line8: error processing line 'wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf'
error: main exception: no ifaces found matching given allow lists
root@DietPi:~# ifquery -l -i /etc/network/interfaces.d/wlan1ifquery -l --allow=hotplug -i /etc/network/interfaces.d/wlan1^C
root@DietPi:~# ifquery -l --allow=hotplug -i /etc/network/interfaces.d/wlan1
error: /etc/network/interfaces.d/wlan1: line6: error processing line 'pre-up iw dev wlan1 set power_save off'
error: /etc/network/interfaces.d/wlan1: line7: error processing line 'post-down iw dev wlan1 set power_save on'
error: /etc/network/interfaces.d/wlan1: line8: error processing line 'wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf'
error: main exception: no ifaces found matching given allow lists
root@DietPi:~# ifquery -l
error: main exception: no ifaces found matching given allow lists
root@DietPi:~# ifquery -l --allow=hotplug
wlan0
root@DietPi:~# cat /etc/network/interfaces.d/wlan1
# WiFi-USB
iface wlan1 inet dhcp
#auto wlan1
allow-hotplug wlan1
#dns-nameservers 192.168.1.99 172.31.0.2
pre-up iw dev wlan1 set power_save off
post-down iw dev wlan1 set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Hmm Debian docs say something else
https://wiki.debian.org/NetworkConfiguration#Using_DHCP_to_automatically_configure_the_interface and https://manpages.debian.org/bookworm/ifupdown/interfaces.5.en.html
BUT I think the issue now is the order of the lines:
The auto
and/or allow
directive needs to come before the iface
directive.
But still wonder about the error processing line
messages, but maybe thats because the directive order is wrong
I did the adjustments:
root@DietPi:~# ifquery -l --allow=hotplug -i /etc/network/interfaces.d/wlan1
wlan1
root@DietPi:~# ifquery -l -i /etc/network/interfaces.d/wlan1
error: main exception: no ifaces found matching given allow lists
root@DietPi:~# ifquery -l --allow=hotplug;
wlan0
root@DietPi:~# ifquery -l;
error: main exception: no ifaces found matching given allow lists
root@DietPi:~# cat /etc/network/interfaces.d/wlan1
# WiFi-USB
#auto wlan1
allow-hotplug wlan1
iface wlan1 inet dhcp
#dns-nameservers 192.168.1.99 172.31.0.2
#pre-up iw dev wlan1 set power_save off
#post-down iw dev wlan1 set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
root@DietPi:~#
At least this looks good now. But it’s still not sourced into the main config:
which is weird. I tried this myself, just specied another interface wlan1
in interfaces.d/
and in my case it’s also listed:
root@RPi4:~# ifquery -l --allow=hotplug
wlan1
eth0
Can you verify you have this line in /etc/network/interfaces
:
# Drop-in configs
source interfaces.d/*
Also please check permissions of the file and dir:
ls -al /etc/network/interfaces.d
Drop-in is present:
root@DietPi:~# ls -al /etc/network/interfaces.d
total 16
drwxr-xr-x 2 root root 4096 Dec 20 10:38 .
drwxr-xr-x 8 root root 4096 Dec 20 10:34 ..
-rw-r--r-- 1 root root 237 Dec 20 10:11 wlan1
-rw-r--r-- 1 root root 222 Dec 20 10:38 wlan2
root@DietPi:~# cat /etc/network/interfaces | grep -i source
source interfaces.d/*
I connected a new adapter, another Alfa 2.4G only adapter and I face the same issue as the Mediatek one.
For this adapter I replicated the config above (adjusting to wlan2, the new ID for the adapter).
Please do note that this DietPi install is fresh and flashed two days ago with no customization or else.
Please do also note that I’m trying to get this setup working as I’m unable to use the 2.4G only on the integrated interface. Unfortunately this device is in a difficult location and it tries to use 5Ghz all the time, causing continuous disconnections (I can’t and I don’t want to use different SSID names).
Ok,
you could specify a frequency list in wpa_supplicant.conf
to only use the 2,4 GHz ones:
freq_list=2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462
But it’s still interesting why your drop-in config is not recognized
Indeed, I have no other clues so far!