Raspberry-Pi

Hostapd 不適用於我的一台設備

  • May 9, 2019

我正在嘗試將我的 Raspberry Pi Compute Module 3+ 設置為帶有 WiFi 加密狗的接入點的接入點。

我正在關注本教程:https ://elinux.org/RPI-Wireless-Hotspot 。

我可以使用加密狗 EP-N8508GS 設置接入點,但是當我嘗試使用 TL-WN722N 時,出現以下錯誤:

pi@raspberrypi:~ $ sudo service hostapd start
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.

這似乎是 nl80211 驅動程序的問題,但我真的不明白為什麼它適用於第一個加密狗而不適用於另一個加密狗。我想嘗試使用 tp-link 加密狗,因為第一個不支持 AP 模式並在設備嘗試連接時使 kernell 崩潰。

$ 服務主機狀態

pi@raspberrypi:~ $ service hostapd status
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
  Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
  Active: activating (auto-restart) (Result: exit-code) since Mon 2019-05-06 03:49:27 BST; 1
 Process: 1103 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF

May 06 03:49:27 raspberrypi systemd[1]: hostapd.service: Control process exited, code=exited
May 06 03:49:27 raspberrypi systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.
May 06 03:49:27 raspberrypi systemd[1]: hostapd.service: Unit entered failed state.
May 06 03:49:27 raspberrypi systemd[1]: hostapd.service: Failed with result 'exit-code'.

$ journalctl -xe

pi@raspberrypi:~ $ journalctl -xe
May 06 04:10:22 raspberrypi hostapd[619]: nl80211: Driver does not support authentication/ass
May 06 04:10:22 raspberrypi hostapd[619]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
May 06 04:10:22 raspberrypi hostapd[619]: nl80211 driver initialization failed.
May 06 04:10:22 raspberrypi hostapd[619]: wlan0: interface state UNINITIALIZED->DISABLED
May 06 04:10:22 raspberrypi hostapd[619]: wlan0: AP-DISABLED
May 06 04:10:22 raspberrypi hostapd[619]: hostapd_free_hapd_data: Interface wlan0 wasn't star
May 06 04:10:22 raspberrypi systemd[1]: hostapd.service: Control process exited, code=exited
May 06 04:10:22 raspberrypi systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.
-- Subject: Unit hostapd.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit hostapd.service has failed.
--
-- The result is failed.
May 06 04:10:22 raspberrypi systemd[1]: hostapd.service: Unit entered failed state.
May 06 04:10:22 raspberrypi systemd[1]: hostapd.service: Failed with result 'exit-code'.
May 06 04:10:25 raspberrypi systemd[1]: hostapd.service: Service hold-off time over, scheduli
May 06 04:10:25 raspberrypi systemd[1]: Stopped Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/W
-- Subject: Unit hostapd.service has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit hostapd.service has finished shutting down.
May 06 04:10:25 raspberrypi systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/
-- Subject: Unit hostapd.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit hostapd.service has begun starting up.
May 06 04:10:25 raspberrypi hostapd[621]: Configuration file: /etc/hostapd/hostapd.conf
May 06 04:10:25 raspberrypi hostapd[621]: nl80211: Driver does not support authentication/ass
May 06 04:10:25 raspberrypi hostapd[621]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
May 06 04:10:25 raspberrypi hostapd[621]: nl80211 driver initialization failed.
May 06 04:10:25 raspberrypi hostapd[621]: wlan0: interface state UNINITIALIZED->DISABLED
May 06 04:10:25 raspberrypi hostapd[621]: wlan0: AP-DISABLED
May 06 04:10:25 raspberrypi hostapd[621]: hostapd_free_hapd_data: Interface wlan0 wasn't star
May 06 04:10:25 raspberrypi systemd[1]: hostapd.service: Control process exited, code=exited
May 06 04:10:25 raspberrypi systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.
-- Subject: Unit hostapd.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit hostapd.service has failed.
--
-- The result is failed.
May 06 04:10:25 raspberrypi systemd[1]: hostapd.service: Unit entered failed state.
May 06 04:10:25 raspberrypi systemd[1]: hostapd.service: Failed with result 'exit-code'.

我的配置:

/lib/systemd/system/hostapd.service

pi@raspberrypi:~ $ cat /lib/systemd/system/hostapd.service
[Unit]
Description=Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
After=network.target

[Service]
Type=forking
PIDFile=/run/hostapd.pid
Restart=on-failure
RestartSec=2
EnvironmentFile=/etc/default/hostapd
ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF}

/etc/default/hostapd

pi@raspberrypi:~ $ cat /etc/default/hostapd
# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"

# Additional daemon options to be appended to hostapd command:-
#       -d   show more debug messages (-dd for even more)
#       -K   include key data in debug messages
#       -t   include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

/etc/hostapd/hostapd.conf

pi@raspberrypi:~ $ cat /etc/hostapd/hostapd.conf
interface=wlan0
ssid=MyAP
hw_mode=g
channel=1
auth_algs=1
ieee80211n=1          # 802.11n support
wmm_enabled=1         # QoS support
ht_capab=[HT40+][SHORT-GI-20][DSSS_CCK-40]

看來您需要 tp-link USB dongle soft-AP 的驅動程序。我通過安裝此驅動程序解決了這個問題。你可以找到它:這裡

引用自:https://unix.stackexchange.com/questions/517325