hostapd:无法设置频道(频率= 2417):-16(设备或资源繁忙)


0

我正在尝试在Raspberry Pi上设置一个WiFi接入点。我将网络接口设置为静态IP并安装了hostapd

我正在使用此配置:

# 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

但是,当我像这样运行它时,# hostapd -dd /etc/hostapd/hostapd.conf会得到以下日志:

# 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)

我能发现的唯一真实错误是: nl80211: Failed to set channel (freq=2417): -16 (Device or resource busy)

虽然我不知道如何检查该设备会使用什么。我可能已经设置了一些东西,但我不记得是什么了。因此,我非常感谢能够向我指出正确方向的人,或者更笼统地向我展示了如何确定使用该设备的过程。

提前致谢。

Answers:


1

解决方法一:

你可以试试

 sudo rfkill unblock wlan

并重复

sudo hostapd /etc/hostapd/hostapd.conf

按照此处的建议并在我的树莓派上进行了测试,在那我收到了与您相同的错误消息。
在我的情况下,似乎hostapd已经以某种方式运行,sudo killall hostapd随后sudo hostapd /etc/hostpad/hostapd.conf也完成了技巧。

解决方案二:

或者,您可以添加行

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

到文件

/etc/default/hostapd

然后重启树莓派,然后在启动后启用hostapd,如官方文档中所述

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.