2

I have a Pi Zero 2 W running Raspbian Buster where I need to disable the onboard WiFi, wlan0, and use a USB WiFi dongle. How do I make wlan1 join my WiFi network?

I have tried various approaches, but so far the USB WiFi (wlan1) always fails to join the network. Once I can get wlan1 to join the network, I plan to disable the built in WiFi (wlan0) by adding to /boot/config.txt: dtoverlay=disable-wifi

Currently, I've changed my files in /etc/network/interfaces.d/ to be:

/etc/network/interfaces.d/wlan0

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/network/interfaces.d/wlan1

auto wlan1
iface wlan1 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

My /etc/wpa_supplicant/wpa_supplicant.conf file contains:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=US

network={
    ssid="<my SSID>"
    psk=<my psk>
}

The ifconfig command returns:

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 13  bytes 1756 (1.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1756 (1.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet <XXXX>  netmask 255.255.255.0  broadcast <XXXX>
        inet6 <XXXX>  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:49:ca:e2  txqueuelen 1000  (Ethernet)
        RX packets 765  bytes 57373 (56.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 556  bytes 82690 (80.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:0c:43:00:1e:62  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

iwconfig returns (FYI, I have turned off power management for the WiFi):

lo        no wireless extensions.

wlan0     IEEE 802.11  ESSID:"<My SSID>"  
          Mode:Managed  Frequency:2.432 GHz  Access Point: <XXXX>   
          Bit Rate=14.4 Mb/s   Tx-Power=31 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=54/70  Signal level=-56 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:95  Invalid misc:0   Missed beacon:0

wlan1     IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=30 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

sudo systemctl status networking.service returns:

● networking.service - Raise network interfaces
     Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2022-12-19 15:52:17 EST; 5min ago
       Docs: man:interfaces(5)
    Process: 418 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
   Main PID: 418 (code=exited, status=1/FAILURE)
        CPU: 229ms

Dec 19 15:52:17 mypi wpa_supplicant[460]: rfkill: Cannot get wiphy information
Dec 19 15:52:17 mypi wpa_supplicant[460]: Could not read interface wlan1 flags: No such device
Dec 19 15:52:17 mypi wpa_supplicant[460]: WEXT: Could not set interface 'wlan1' UP
Dec 19 15:52:17 mypi wpa_supplicant[460]: wlan1: Failed to initialize driver interface
Dec 19 15:52:17 mypi ifup[455]: /etc/network/if-pre-up.d/wpasupplicant: 120: cannot create /dev/stderr: No such device or address
Dec 19 15:52:17 mypi ifup[447]: run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Dec 19 15:52:17 mypi ifup[418]: ifup: failed to bring up wlan1
Dec 19 15:52:17 mypi systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Dec 19 15:52:17 mypi systemd[1]: networking.service: Failed with result 'exit-code'.
Dec 19 15:52:17 mypi systemd[1]: Failed to start Raise network interfaces.
2

1 Answer 1

2

Figured it out. Much simpler than I thought. In the file /boot/config.txt, I added the following lines:

# Disable onboard WiFi
dtoverlay=disable-wifi

That's it. My USB WiFi dongle became wlan0 and was configured by the system as the onboard WiFi would have been.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.