平台:ubuntu 18.04
安装hostapd:
$sudo apt update
$sudo apt install hostapd
执行:
$systemctl start hostapd
启动hostapd,出现:
Failed to start hostapd.service: Unit hostapd.service is masked.
解决办法:(参考:Failed to start hostapd.service: Unit hostapd.service is masked - 简书 (jianshu.com))
$sudo systemctl unmask hostapd
$sudo systemctl enable hostapd
$sudo systemctl start hostapd
再次执行systemctl start hostapd
,出现:
hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authent
Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Tue 2022-10-11 09:37:15 UTC; 8s ago
Process: 1320 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS
Oct 11 09:37:15 firefly systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 80
Oct 11 09:37:15 firefly hostapd[1320]: Configuration file:
Oct 11 09:37:15 firefly hostapd[1320]: Could not open configuration file '' for
Oct 11 09:37:15 firefly hostapd[1320]: Failed to set up interface with
Oct 11 09:37:15 firefly hostapd[1320]: Failed to initialize interface
Oct 11 09:37:15 firefly systemd[1]: hostapd.service: Control process exited, cod
Oct 11 09:37:15 firefly systemd[1]: hostapd.service: Failed with result 'exit-co
Oct 11 09:37:15 firefly systemd[1]: Failed to start Advanced IEEE 802.11 AP and
出错原因:Could not open configuration file '' for reading
。找不到名为' '的配置文件。
解决办法:(参考hostapd启动错误消息 | 码农俱乐部 - Golang中国 - Go语言中文社区 (mlog.club))
-
执行:
sudo hostapd 配置文件绝对路径
-
打开文件
/etc/default/hostapd
取消
DAEMON_CONF=""
的注释,并使:DAEMON_CONF="/etc/hostapd/hostapd.conf"
问题解决。
masked状态?
参考: