}

Fix: Error for Wireless Request Set Mode [iwconfig Device or Resource Busy]

Understanding the "Device or Resource Busy" Error

When trying to change your wireless adapter to monitor mode using iwconfig, you may encounter the frustrating "device or resource busy" error. This commonly happens when attempting penetration testing with tools like aircrack-ng, airodump-ng, or when setting up a wireless adapter for packet capture.

The Error Messages

When you execute the iwconfig command to change the channel or mode:

iwconfig wlan0 mode monitor

You typically see one of these error messages:

Error for wireless request "Set Mode" (8B06) :
        SET failed on device wlan0 ; Device or resource busy

Or when using airodump-ng:

ioctl(SIOCSIWMODE) failed: Device or resource busy
ARP linktype is set to 1 (Ethernet) - expected ARPHRD_IEEE80211,
ARPHRD_IEEE80211_FULL or ARPHRD_IEEE80211_PRISM instead. Make
sure RFMON is enabled: run 'airmon-ng start wlan0 <#>'
Sysfs injection support was not found either.

Why Does This Error Occur?

The "device or resource busy" error occurs because:

  1. Another process is using the wireless interface (NetworkManager, wpa_supplicant, dhcpcd)
  2. The interface is connected to a WiFi network
  3. The interface wasn't brought down before attempting mode change
  4. Background services are managing the adapter

Let's go through all the solutions to fix this issue.


Solution 1: Check for Interfering Processes

The most common cause is background processes using your wireless interface. Use airmon-ng to identify them:

sudo airmon-ng check

Example output showing interfering processes:

Found 5 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to run 'airmon-ng check kill'

  PID Name
  332 avahi-daemon
  343 avahi-daemon
  392 wpa_supplicant
  408 wpa_supplicant
  539 dhcpcd

To kill all interfering processes automatically:

sudo airmon-ng check kill

This will terminate NetworkManager, wpa_supplicant, and other services that might interfere.


Solution 2: Stop ifplugd Service

The ifplugd daemon manages network interfaces and can prevent mode changes:

sudo service ifplugd stop
sudo ifconfig wlan0 down

On systemd-based systems:

sudo systemctl stop ifplugd
sudo ip link set wlan0 down

Solution 3: Bring Interface Down Before Mode Change

The classic solution — always bring the interface down before changing modes:

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
sudo ifconfig wlan0 up

Or using the modern ip command:

sudo ip link set wlan0 down
sudo iwconfig wlan0 mode monitor
sudo ip link set wlan0 up

Solution 4: Use airmon-ng to Start Monitor Mode

Let airmon-ng handle the mode change, which automatically manages interface states:

sudo airmon-ng start wlan0

To start on a specific channel:

sudo airmon-ng start wlan0 11

This creates a new monitor interface (usually wlan0mon) and handles killing interfering processes.


Solution 5: Disable wpa_supplicant Permanently

If wpa_supplicant keeps causing issues, disable it:

sudo service wpa_supplicant stop
sudo systemctl mask wpa_supplicant.service

To also disable dhcpcd:

sudo systemctl disable dhcpcd
sudo systemctl stop dhcpcd

To re-enable later:

sudo systemctl unmask wpa_supplicant.service
sudo systemctl enable wpa_supplicant.service

Solution 6: Stop NetworkManager

NetworkManager often manages wireless interfaces automatically:

sudo systemctl stop NetworkManager
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
sudo ifconfig wlan0 up

You can also tell NetworkManager to ignore your wireless interface by adding to /etc/NetworkManager/NetworkManager.conf:

[keyfile]
unmanaged-devices=interface-name:wlan0

Then restart NetworkManager:

sudo systemctl restart NetworkManager

Solution 7: Reboot or Replug USB Device

If nothing else works:

  1. For USB adapters: Unplug the device, wait 5 seconds, and plug it back in
  2. For built-in cards: Reboot your computer

After rebooting, immediately kill interfering processes before they start managing the interface:

sudo airmon-ng check kill
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
sudo ifconfig wlan0 up

Quick Fix Script

Create a script to automate the process:

#!/bin/bash
# monitor-mode.sh - Enable monitor mode on wireless interface

INTERFACE=${1:-wlan0}

echo "[*] Killing interfering processes..."
sudo airmon-ng check kill

echo "[*] Bringing $INTERFACE down..."
sudo ip link set $INTERFACE down

echo "[*] Setting monitor mode..."
sudo iwconfig $INTERFACE mode monitor

echo "[*] Bringing $INTERFACE up..."
sudo ip link set $INTERFACE up

echo "[*] Verifying mode..."
iwconfig $INTERFACE | grep Mode

echo "[+] Done!"

Save as monitor-mode.sh and run with:

chmod +x monitor-mode.sh
./monitor-mode.sh wlan0

Summary

The "Error for wireless request Set Mode - Device or resource busy" typically means another process is using your wireless interface. The solutions in order of recommendation:

  1. Run sudo airmon-ng check kill to terminate interfering processes
  2. Bring the interface down with sudo ifconfig wlan0 down before changing modes
  3. Use sudo airmon-ng start wlan0 to let airmon-ng handle everything
  4. Stop NetworkManager and wpa_supplicant if they keep interfering
  5. Replug USB adapter or reboot as last resort

These solutions work for Kali Linux, Ubuntu, Debian, and most other Linux distributions when using wireless adapters for penetration testing or packet capture.


Related Tutorials