wlan0:通过本地选择取消验证

问题描述

我正在尝试在设备上设置电台模式。如果我在启动后在命令行上输入wpa_supplicant命令,它会很好地工作。但是当我在脚本中提供这些命令然后进行systemd服务时断开连接。断开连接后,wlan0仍然具有IP地址。我必须使用ip addr flush dev wlan0将其刷新。 (此外,我的wpa_supplicant可执行文件位于/ home / root中。)

这有效:以下是我在cli上手动给出的命令,并且能够ping通。没问题。

/home/root/wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf
dhclient -i wlan0

或者可以运行脚本./station_mode.sh,并且不会出错。我只有在启动下面给出的station.service时才会收到错误消息。


这不起作用-服务中给出的相同命令会引发错误。

我的脚本:station_mode.sh

#!/bin/sh

rfkill unblock all
/home/root/wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf
dhclient -i wlan0

我的系统服务:/etc/systemd/system/station.service

[Unit]
Description=station mode service.

[Service]
Type=simple
ExecStart=/bin/sh /home/root/station_mode.sh

[Install]
WantedBy=multi-user.target

我发出的命令:

systemctl stop wpa_supplicant
systemctl disable --now wpa_supplicant
systemctl start station

输出:

[ 2303.299834] wlan0: authenticate with be:37:a5:d8:96:36
[ 2303.334731] wlan0: send auth to be:37:a5:d8:96:36 (try 1/3)
[ 2303.344189] wlan0: authenticated
[ 2303.348966] wlan0: associate with be:37:a5:d8:96:36 (try 1/3)
[ 2303.369211] wlan0: RX AssocResp from be:37:a5:d8:96:36 (capab=0x1431 status=0 aid=1)
[ 2303.384351] wlan0: associated
[ 2320.245795] wlan0: deauthenticating from be:37:a5:d8:96:36 by local choice (Reason: 3=DEAUTH_LEAVING)

解决方法

我做了journalctl -f,发现State 'stop-sigterm' timed out. Killing.是dhclient被杀死。然后我想起wpa_supplicant在我的station_mode.sh脚本中进入了背景。

因此,Type应该是forking,而不是simple中的station.service

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...