Raspberry pi 尝试在脚本中有条件地启动/usr/sbin/hostapd
此代码运行在raspberry pi3上 我有一个脚本/etc/rc2.d/S05frameapp,可以有条件地启动hostapd(查看是否已设置wifi) 在脚本中(如果未为此设备设置wifi,则运行此部分) 从nohup,在/tmp/hostapd.log中,我看到Raspberry pi 尝试在脚本中有条件地启动/usr/sbin/hostapd,raspberry-pi,raspbian,raspberry-pi3,Raspberry Pi,Raspbian,Raspberry Pi3,此代码运行在raspberry pi3上 我有一个脚本/etc/rc2.d/S05frameapp,可以有条件地启动hostapd(查看是否已设置wifi) 在脚本中(如果未为此设备设置wifi,则运行此部分) 从nohup,在/tmp/hostapd.log中,我看到 cat /tmp/hostapd.log Configuration file: /etc/hostapd/hostapd.conf Failed to create interface mon.wlan0: -95 (Oper
cat /tmp/hostapd.log
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.wlan0: -95 (Operation not supported)
Could not set channel for kernel driver
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: Unable to setup interface.
hostapd_free_hapd_data: Interface wlan0 wasn't started
但是,如果我现在登录(通过硬连线网络)并运行以下程序,它就会工作
#/usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.wlan0: -95 (Operation not supported)
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b8:27:eb:40:bd:a4 and ssid
"WhatUlooknAtWillis"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
所以我想这可能是个时间问题?这就是我目前让脚本运行S05的原因
谢谢你的帮助我发现了这个问题。
这是启动hostapd和dnsmasq的顺序
修复方法是您需要先启动dnsmasq,然后启动hostapd
echo "Starting dnsmasq ";
/usr/sbin/service dnsmasq start
echo "Starting hostapd";
/usr/bin/nohup /usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf >> /tmp/hostapd.log 2>&1 &
echo "Starting dnsmasq ";
/usr/sbin/service dnsmasq start
echo "Starting hostapd";
/usr/bin/nohup /usr/sbin/hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf >> /tmp/hostapd.log 2>&1 &