我计划使用 Arch Linux 上的 NetworkManager 在我的笔记本电脑上托管一个热点。创建热点配置并不困难。但是,当我尝试激活创建的热点连接时,出现错误。
Error: Connection activation failed: 802.1X supplicant took too long to authenticate
Hint: use 'journalctl -xe NM_CONNECTION=b9ecc651-d491-414d-9c26-a3800cf2c9fd + NM_DEVICE=wlp3s0' to get more details.
我找到了它建议检查的期刊,并将其粘贴到以下内容中:
-- Logs begin at Sat 2019-10-12 06:59:32 UTC, end at Sat 2020-09-26 23:29:53 UTC. --
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.0692] device (wlp3s0): set-hw-addr: set MAC address to D2:D0:FE:25:82:24 (scanning)
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1337] device (wlp3s0): Activation: starting connection 'Hotspot' (b9ecc651-d491-414d-9c26-a3800cf2c9fd)
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1349] device (wlp3s0): supplicant interface state: completed -> disconnected
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1526] device (wlp3s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1611] device (wlp3s0): set-hw-addr: set-cloned MAC address to 7C:7A:91:3D:C5:ED (stable)
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1639] device (wlp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1643] device (wlp3s0): Activation: (wifi) access point 'Hotspot' has security, but secrets are required.
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1643] device (wlp3s0): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1749] device (wlp3s0): supplicant interface state: disconnected -> interface_disabled
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1769] device (wlp3s0): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1781] device (wlp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1785] device (wlp3s0): Activation: (wifi) connection 'Hotspot' has security, and secrets exist. No new secrets needed.
Sep 26 23:29:23 ArchPad NetworkManager[1201]: <info> [1601162963.1817] device (wlp3s0): supplicant interface state: interface_disabled -> disconnected
Sep 26 23:29:48 ArchPad NetworkManager[1201]: <warn> [1601162988.5177] device (wlp3s0): Activation: (wifi) Hotspot network creation took too long, failing activation
Sep 26 23:29:48 ArchPad NetworkManager[1201]: <info> [1601162988.5178] device (wlp3s0): state change: config -> failed (reason 'supplicant-timeout', sys-iface-state: 'managed')
Sep 26 23:29:48 ArchPad NetworkManager[1201]: <warn> [1601162988.5199] device (wlp3s0): Activation: failed for connection 'Hotspot'
Sep 26 23:29:48 ArchPad NetworkManager[1201]: <info> [1601162988.5215] device (wlp3s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Sep 26 23:29:48 ArchPad NetworkManager[1201]: <info> [1601162988.5263] device (wlp3s0): set-hw-addr: set MAC address to 6E:7F:89:23:28:29 (scanning)
看起来 wpa_supplicant 花费太多时间来设置热点。我检查了热点连接的配置,我认为没有任何与请求者超时相关的内容:
connection.id: Hotspot
connection.uuid: b9ecc651-d491-414d-9c26-a3800cf2c9fd
connection.stable-id: --
connection.type: 802-11-wireless
connection.interface-name: wlp3s0
connection.autoconnect: no
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.multi-connect: 0 (default)
connection.auth-retries: -1
connection.timestamp: 0
connection.read-only: no
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: unknown
connection.lldp: default
connection.mdns: -1 (default)
connection.llmnr: -1 (default)
connection.wait-device-timeout: -1
802-11-wireless.ssid: TP-Link
802-11-wireless.mode: ap
802-11-wireless.band: a
802-11-wireless.channel: 7
802-11-wireless.bssid: --
802-11-wireless.rate: 0
802-11-wireless.tx-power: 0
802-11-wireless.mac-address: --
802-11-wireless.cloned-mac-address: stable
802-11-wireless.generate-mac-address-mask:FE:FF:FF:00:00:00
802-11-wireless.mac-address-blacklist: --
802-11-wireless.mac-address-randomization:default
802-11-wireless.mtu: auto
802-11-wireless.seen-bssids: --
802-11-wireless.hidden: no
802-11-wireless.powersave: 0 (default)
802-11-wireless.wake-on-wlan: 0x1 (default)
802-11-wireless-security.key-mgmt: wpa-psk
802-11-wireless-security.wep-tx-keyidx: 0
802-11-wireless-security.auth-alg: --
802-11-wireless-security.proto: rsn
802-11-wireless-security.pairwise: ccmp
802-11-wireless-security.group: ccmp
802-11-wireless-security.pmf: 0 (default)
802-11-wireless-security.leap-username: --
802-11-wireless-security.wep-key0: <hidden>
802-11-wireless-security.wep-key1: <hidden>
802-11-wireless-security.wep-key2: <hidden>
802-11-wireless-security.wep-key3: <hidden>
802-11-wireless-security.wep-key-flags: 0 (none)
802-11-wireless-security.wep-key-type: unknown
802-11-wireless-security.psk: <hidden>
802-11-wireless-security.psk-flags: 0 (none)
802-11-wireless-security.leap-password: <hidden>
802-11-wireless-security.leap-password-flags:0 (none)
802-11-wireless-security.wps-method: 0x0 (default)
802-11-wireless-security.fils: 0 (default)
ipv4.method: shared
ipv4.dns: --
ipv4.dns-search: --
ipv4.dns-options: --
ipv4.dns-priority: 0
ipv4.addresses: --
ipv4.gateway: --
ipv4.routes: --
ipv4.route-metric: -1
ipv4.route-table: 0 (unspec)
ipv4.routing-rules: --
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-iaid: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.dhcp-hostname-flags: 0x0 (none)
ipv4.never-default: no
ipv4.may-fail: yes
ipv4.dad-timeout: -1 (default)
ipv6.method: ignore
ipv6.dns: --
ipv6.dns-search: --
ipv6.dns-options: --
ipv6.dns-priority: 0
ipv6.addresses: --
ipv6.gateway: --
ipv6.routes: --
ipv6.route-metric: -1
ipv6.route-table: 0 (unspec)
ipv6.routing-rules: --
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.ra-timeout: 0 (default)
ipv6.dhcp-duid: --
ipv6.dhcp-iaid: --
ipv6.dhcp-timeout: 0 (default)
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.dhcp-hostname-flags: 0x0 (none)
ipv6.token: --
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
另外,我笔记本上的无线网卡型号是Intel Wireless-AC 7260,我认为它能够托管热点。有人对这个问题有什么想法吗?
更新802-11-wireless.channel
: 更改为合适的值后,问题仍然存在,以下日志
-- Journal begins at Mon 2020-12-14 23:36:12 UTC, ends at Fri 2021-01-29 00:07:08 UTC. --
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3131] device (wlp3s0): Activation: starting connection 'Hotspot' (1b0ceabe-4f67-4b5a-8e09-6924744535d4)
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3134] device (wlp3s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3527] device (wlp3s0): set-hw-addr: reset MAC address to 7C:7A:91:A2:BB:B5 (preserve)
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3564] device (wlp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3573] device (wlp3s0): Activation: (wifi) access point 'Hotspot' has security, but secrets are required.
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3575] device (wlp3s0): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3598] device (wlp3s0): supplicant interface state: inactive -> interface_disabled
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3632] device (wlp3s0): supplicant interface state: interface_disabled -> inactive
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3649] device (wlp3s0): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3675] device (wlp3s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3679] device (wlp3s0): Activation: (wifi) connection 'Hotspot' has security, and secrets exist. No new secrets needed.
Jan 29 00:05:05 ArchPad NetworkManager[1175]: <info> [1611878705.3911] device (wlp3s0): supplicant interface state: inactive -> disconnected
Jan 29 00:05:30 ArchPad NetworkManager[1175]: <warn> [1611878730.5137] device (wlp3s0): Activation: (wifi) Hotspot network creation took too long, failing activation
Jan 29 00:05:30 ArchPad NetworkManager[1175]: <info> [1611878730.5138] device (wlp3s0): state change: config -> failed (reason 'supplicant-timeout', sys-iface-state: 'managed')
Jan 29 00:05:30 ArchPad NetworkManager[1175]: <warn> [1611878730.5159] device (wlp3s0): Activation: failed for connection 'Hotspot'
Jan 29 00:05:30 ArchPad NetworkManager[1175]: <info> [1611878730.5163] device (wlp3s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Jan 29 00:05:30 ArchPad NetworkManager[1175]: <info> [1611878730.5230] device (wlp3s0): set-hw-addr: set MAC address to B6:1B:A6:1C:81:BD (scanning)
Jan 29 00:05:30 ArchPad NetworkManager[1175]: <info> [1611878730.5280] device (wlp3s0): supplicant interface state: disconnected -> inactive
答案1
我在 Ubuntu 21.10 上也遇到了这个问题:
>nmcli connection up bridge-slave-wlp4s0
Error: Connection activation failed: 802.1X supplicant took too long to authenticate
最终唯一有帮助的是打开日志wpa_supplicant
。
>wpa_cli -i wlp4s0 log_level debug
OK
之后您将开始看到debug
登录journalctl -f
。现在,过滤并跟踪日志:
journalctl -f -u wpa_supplicant -u NetworkManager -u systemd-networkd
保持此打开状态,并在另一个会话中尝试激活您的连接。
就我而言,结果是与频道相关的各种问题,例如,甚至是另一个答案中建议的频道 120:
wpa_supplicant[1030]: Channel 120 (primary) not allowed for AP mode, flags: 0x17b NO-IR RADAR
wpa_supplicant[1030]: hostapd_logger: Configured channel (120) not found from the channel list of current mode (2) IEEE 802.11a
wpa_supplicant[1030]: hostapd_logger: Hardware does not support configured channel
您必须记住,有效渠道取决于许多因素,包括您所在的国家/地区:
iw reg get
就我而言,我有两个条目:
global
country 00: DFS-UNSET
(2402 - 2472 @ 40), (N/A, 20), (N/A)
...
phy#0 (self-managed)
country CA: DFS-UNSET
(2402 - 2437 @ 40), (6, 22), (N/A), AUTO-BW, NO-HT40MINUS, NO-80MHZ, NO-160MHZ
...
我使用以下命令将全局固定为我的国家:
iw reg set CA
您将获得一组适用于您所在地区的频率,并且可以与https://en.wikipedia.org/wiki/List_of_WLAN_channels找到等效的通道。
现在——这还不是我的全部。即使被报告为有效的通道(例如 42)最终也会失败:
wpa_supplicant[1030]: nl80211: Set freq 5210 (ht_enabled=0, vht_enabled=0, he_enabled=0, bandwidth=0 MHz, cf1=0 MHz, cf2=0 MHz)
wpa_supplicant[1030]: * freq=5210
wpa_supplicant[1030]: * he_enabled=0
wpa_supplicant[1030]: * vht_enabled=0
wpa_supplicant[1030]: * ht_enabled=0
wpa_supplicant[1030]: * channel_type=0
wpa_supplicant[1030]: nl80211: kernel reports: Channel is disabled
wpa_supplicant[1030]: nl80211: Failed to set channel (freq=5210): -22 (Invalid argument)
(导致后来出现可怕的“热点网络创建花费太长时间”)
事实证明,尽管iw reg get
正确猜测了我的区域,但未设置以下文件:
> cat /etc/default/crda
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
# the initial regulatory domain setting for IEEE 802.11 devices which operate
# on this system.
#
# Governments assert the right to regulate usage of radio spectrum within
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
# country code suitable for your location or you may infringe on local
# legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.
REGDOMAIN=
就我而言,我调整REGDOMAIN=CA
并重新启动
但还是失败了。
最后,我从日志中注意到这个调试条目:
wpa_supplicant[1029]: P2P: Add operating class 81
wpa_supplicant[1029]: P2P: Channels - hexdump(len=13): 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
wpa_supplicant[1029]: P2P: Add operating class 124
wpa_supplicant[1029]: P2P: Channels - hexdump(len=4): 95 99 9d a1
wpa_supplicant[1029]: P2P: Add operating class 125
wpa_supplicant[1029]: P2P: Channels - hexdump(len=5): 95 99 9d a1 a5
wpa_supplicant[1029]: P2P: Add operating class 126
wpa_supplicant[1029]: P2P: Channels - hexdump(len=2): 95 9d
wpa_supplicant[1029]: P2P: Add operating class 127
wpa_supplicant[1029]: P2P: Channels - hexdump(len=2): 99 a1
wpa_supplicant[1029]: P2P: Update channel list
wpa_supplicant[1029]: P2P: channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13 124:149,153,157,161 125:149,153,157,161,165 126:149,157 127:153,161
所以我尝试了列出的渠道之一:
>nmcli connection modify bridge-slave-wlp4s0 wifi.channel 161
>nmcli connection up bridge-slave-wlp4s0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/19)
它立即起作用了。
所以仍然不知道为什么我的一些频道受到限制,但是查看journalctl并将wpa日志设置为调试,您应该能够找到工作频道列表。
[编辑] 经过更多搜索后,我找到了某些频道不可用的原因。我的 Intel 卡不支持任何非 20Mhz 频段。
这列出了仅在客户端模式下支持的通道:
>iw phy phy0 info | grep "no IR"
phy phy0 info | grep "no IR"
* 5180 MHz [36] (22.0 dBm) (no IR)
* 5200 MHz [40] (22.0 dBm) (no IR)
* 5220 MHz [44] (22.0 dBm) (no IR)
* 5240 MHz [48] (22.0 dBm) (no IR)
* 5260 MHz [52] (22.0 dBm) (no IR, radar detection)
* 5280 MHz [56] (22.0 dBm) (no IR, radar detection)
* 5300 MHz [60] (22.0 dBm) (no IR, radar detection)
* 5320 MHz [64] (22.0 dBm) (no IR, radar detection)
* 5500 MHz [100] (22.0 dBm) (no IR, radar detection)
* 5520 MHz [104] (22.0 dBm) (no IR, radar detection)
* 5540 MHz [108] (22.0 dBm) (no IR, radar detection)
* 5560 MHz [112] (22.0 dBm) (no IR, radar detection)
* 5580 MHz [116] (22.0 dBm) (no IR, radar detection)
* 5600 MHz [120] (22.0 dBm) (no IR, radar detection)
* 5620 MHz [124] (22.0 dBm) (no IR, radar detection)
* 5640 MHz [128] (22.0 dBm) (no IR, radar detection)
* 5660 MHz [132] (22.0 dBm) (no IR, radar detection)
* 5680 MHz [136] (22.0 dBm) (no IR, radar detection)
* 5700 MHz [140] (22.0 dBm) (no IR, radar detection)
* 5720 MHz [144] (22.0 dBm) (no IR, radar detection)
该列表中的其他频道将显示为disabled
- 所以最后,这就是我用来列出可用频道的内容:
iw phy phy0 info | grep "MHz \[" | grep -v "no IR" | grep -v "disabled"
* 2412 MHz [1] (22.0 dBm)
* 2417 MHz [2] (22.0 dBm)
* 2422 MHz [3] (22.0 dBm)
* 2427 MHz [4] (22.0 dBm)
* 2432 MHz [5] (22.0 dBm)
* 2437 MHz [6] (22.0 dBm)
* 2442 MHz [7] (22.0 dBm)
* 2447 MHz [8] (22.0 dBm)
* 2452 MHz [9] (22.0 dBm)
* 2457 MHz [10] (22.0 dBm)
* 2462 MHz [11] (22.0 dBm)
* 2467 MHz [12] (22.0 dBm)
* 2472 MHz [13] (22.0 dBm)
* 5745 MHz [149] (22.0 dBm)
* 5765 MHz [153] (22.0 dBm)
* 5785 MHz [157] (22.0 dBm)
* 5805 MHz [161] (22.0 dBm)
* 5825 MHz [165] (22.0 dBm)
答案2
我知道这个问题已经过时了,但刚刚在 Ubuntu 21.10 上遇到这个错误,我也找到了解决方法。
该问题是由 WiFi MAC 随机化引起的,这意味着每当切换到新的 AP(包括创建热点)时,WiFi 接口都必须关闭和打开。这会导致重新扫描可用的 AP,从而导致您观察到超时。
解决方法是通过添加包含以下内容的文件来禁用 MAC 随机化/etc/NetworkManager/conf.d/99-wifi.conf
:
[device-wifi-no-scan-mac-rand]
wifi.scan-rand-mac-address=no
接下来:
$ sudo systemctl restart NetworkManager
$ sudo systemctl restart wpa_supplicant
你应该可以走了。说实话,我不知道以上哪一项是必要的(如果有的话),但它们是无害的,并且可以为我提供一个可用的 WiFi 热点。