首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >由于多个错误无法启动Hostapd

由于多个错误无法启动Hostapd
EN

Unix & Linux用户
提问于 2018-01-07 16:04:46
回答 2查看 21K关注 0票数 0

我在尝试启动Hostapd时有多个错误,我将发布在尝试启动它并查看状态后获得的错误输出:

代码语言:javascript
运行
复制
   root@l0calh0st:~# 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; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-01-07 16:42:38 CET; 4s ago
  Process: 1682 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, sta

Jan 07 16:42:38 l0calh0st systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticato
Jan 07 16:42:38 l0calh0st hostapd[1682]: Configuration file:
Jan 07 16:42:38 l0calh0st hostapd[1682]: Could not open configuration file '' for reading.
Jan 07 16:42:38 l0calh0st hostapd[1682]: Failed to set up interface with
Jan 07 16:42:38 l0calh0st hostapd[1682]: Failed to initialize interface
Jan 07 16:42:38 l0calh0st systemd[1]: hostapd.service: Control process exited, code=exited status=1
Jan 07 16:42:38 l0calh0st systemd[1]: hostapd.service: Failed with result 'exit-code'.
Jan 07 16:42:38 l0calh0st systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authe

我不知道为什么他找不到配置文件,他似乎在搜索‘又名’我没有编辑任何东西..!在这里,如果我试着开始正常的话:

代码语言:javascript
运行
复制
root@l0calh0st:~# 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.

如果使用命令"journalct1 -xe“,我得到:

代码语言:javascript
运行
复制
root@l0calh0st:~# journalctl -xe
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- 
-- The start-up result is RESULT.
Jan 07 16:57:44 l0calh0st systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
-- Subject: Unit hostapd.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit hostapd.service has begun starting up.
Jan 07 16:57:44 l0calh0st hostapd[1865]: Configuration file:
Jan 07 16:57:44 l0calh0st hostapd[1865]: Could not open configuration file '' for reading.
Jan 07 16:57:44 l0calh0st hostapd[1865]: Failed to set up interface with
Jan 07 16:57:44 l0calh0st hostapd[1865]: Failed to initialize interface
Jan 07 16:57:44 l0calh0st systemd[1]: hostapd.service: Control process exited, code=exited status=1
Jan 07 16:57:44 l0calh0st systemd[1]: hostapd.service: Failed with result 'exit-code'.
Jan 07 16:57:44 l0calh0st systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
-- Subject: Unit hostapd.service has failed
-- Defined-By: systemd 
-- Unit hostapd.service has failed.
-- 
-- The result is RESULT.
lines 1521-1543/1543 (END)

编辑:好的,我找到了"hostapd.service“文件,但是我没有看到任何注释。(#?):

代码语言:javascript
运行
复制
[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
EnvironmentFile=/etc/default/hostapd
ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF}

[Install]
WantedBy=multi-user.target

这是/etc/default/hostapd文件:

代码语言:javascript
运行
复制
# 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=""

# 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=""
EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2018-01-07 16:28:33

您的系统正在使用systemd。在一些发行版中,我注意到使用遗留的service包装器可以隐藏一些使用systemd本机systemctl命令可以看到的错误消息。但看起来这里有足够的信息。

/lib/systemd/system/hostapd.service文件中,确定用于启动hostapd的实际命令的行显然如下:

代码语言:javascript
运行
复制
ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF}

由于它包含在systemd's默认集之外的环境变量(详见man systemd.exec ),hostapd.service文件可能有一个选项,如Environment=EnvironmentFile=PassEnvironment=

代码语言:javascript
运行
复制
EnvironmentFile=/etc/default/hostapd.conf

如果存在这样的文件,那么在启动hostapd之前,它可能有一些注释掉的默认设置,您需要进行编辑以匹配系统配置,然后取消注释。

通常,这样的文件是由您的发行版维护人员准备的,并且有一些有用的注释来描述您需要做什么。如果没有,那么/usr/share/doc/hostapd-*/目录中可能有一些特定于发行版的信息,您应该先阅读这些信息。

票数 4
EN

Unix & Linux用户

发布于 2019-07-30 05:03:02

我和你在Raspbian拉伸上也有同样的问题。我只是在packages.debian.org上搜索,发现了两个不同的包。我安装了"hostapd_2.4-1+deb9u4_armhf.deb",它有很多问题。所以,我安装了"hostapd_2.7+git20190128+0c1e29f-4_bpo9+2_armhf.deb",它很好。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/415405

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档