2

I'm trying to set up a WiFi Access Point on my Raspberry Pi. I set up the network interface to a static IP and installed hostapd.

I'm using this config:

# Interface and Driver
interface=wlan0
#driver=nl80211

# Config
ssid=AP
channel=2
hw_mode=g
ieee80211n=1
ieee80211d=1
country_code=DE
wmm_enabled=1

# Encryption
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=xxxxxxxxxxxxxx

However when I run it like this # hostapd -dd /etc/hostapd/hostapd.conf I get this log:

# hostapd -dd /etc/hostapd/hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
nl80211: interface wlan0 in phy phy0
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Using driver-based off-channel TX
nl80211: Add own interface ifindex 3
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Failed to set interface 3 to mode 3: -95 (Operation not supported)
nl80211: Interface already in requested mode - ignore error
nl80211: Create interface iftype 6 (MONITOR)
nl80211: New interface mon.wlan0 created: ifindex=7
nl80211: Add own interface ifindex 7
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
nl80211: Regulatory information - country=DE
nl80211: 2400-2483 @ 40 MHz
nl80211: 5150-5250 @ 80 MHz
nl80211: 5250-5350 @ 80 MHz
nl80211: 5470-5725 @ 160 MHz
nl80211: 5725-5875 @ 80 MHz
nl80211: 57000-66000 @ 2160 MHz
nl80211: Added 802.11b mode based on 802.11g information
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=13 freq=2472 MHz max_tx_power=20 dBm
Completing interface initialization
Mode: IEEE 802.11g  Channel: 2  Frequency: 2417 MHz
nl80211: Set freq 2417 (ht_enabled=1 sec_channel_offset=0)
nl80211: Failed to set channel (freq=2417): -16 (Device or resource busy)
Could not set channel for kernel driver
wlan0: Unable to setup interface.
Flushing old station entries
Could not connect to kernel driver.
Deauthenticate all stations
nl80211: Remove interface ifindex=7
netlink: Operstate: linkmode=0, operstate=6
nl80211: Set mode ifindex 3 iftype 2 (STATION)

The only real error I can spot is this: nl80211: Failed to set channel (freq=2417): -16 (Device or resource busy)

Though I do not know how I can check what would be using that device. I might have set something up way back but I can't remember what it was. So I'd highly apprechiate someone being able to point me in the right direction or more generally show me how I can find out which process is using the device.

Thanks in advance.

1 Answer 1

2

Solution one:

You could try

 sudo rfkill unblock wlan

and repeat

sudo hostapd /etc/hostapd/hostapd.conf

as proposed here and tested on my raspberry pi, where I received the same error message as you.
In my case it seems that hostapd was already somehow running, as sudo killall hostapd followed by sudo hostapd /etc/hostpad/hostapd.conf also did the trick.

Solution two:

Alternatively, you can add the line

DAEMON_CONF="/etc/hostapd/hostapd.conf"

to the file

/etc/default/hostapd

and restart your raspberry pi, then hostapd will be enabled after startup, as described in the official documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .