nanoPC-T4 在 # sudo apt update 和 sudo apt upgrade
升级或安装软件 sudo apt install xxx
时遇到以下问题:Failed to set up interface with /etc/hostapd/
Setting up hostapd (2:2.6-15ubuntu2.8) ...
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript hostapd, action "restart" failed.
● 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: enabled)
Active: failed (Result: exit-code) since Fri 2022-11-11 07:23:16 UTC; 22ms ago
Process: 12218 ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=1/FAILURE)
Nov 11 07:23:16 NanoPC-T4 systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Nov 11 07:23:16 NanoPC-T4 hostapd[12218]: Configuration file: /etc/hostapd/hostapd.conf
Nov 11 07:23:16 NanoPC-T4 hostapd[12218]: Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
Nov 11 07:23:16 NanoPC-T4 hostapd[12218]: Failed to set up interface with /etc/hostapd/hostapd.conf
Nov 11 07:23:16 NanoPC-T4 hostapd[12218]: Failed to initialize interface
Nov 11 07:23:16 NanoPC-T4 systemd[1]: hostapd.service: Control process exited, code=exited status=1
Nov 11 07:23:16 NanoPC-T4 systemd[1]: hostapd.service: Failed with result 'exit-code'.
Nov 11 07:23:16 NanoPC-T4 systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
dpkg: error processing package hostapd (--configure):
installed hostapd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
hostapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
【解决】
发现问题
Could not open configuration file '/etc/hostapd/hostapd.conf' for reading.
在目录下查看 hostapd.conf, 发现没有该文件,当然无法打开配置文件了。
如何重新找到该文件
在目录 /usr/share/doc/hostapd 下可以看到有一个 README.Debian 文件, 文件内容如下:
hostapd for Debian
------------------
This package provides two methods for managing hostapd process(es); an
initscript and an ifupdown hook. Both methods require creation of a
hostapd daemon configuration file (eg. /etc/hostapd/hostapd.conf) to
function correctly.
An example hostapd.conf may be used as a template but _must_ be edited
to suit your local configuration. An example is located at:
/usr/share/doc/hostapd/examples/hostapd.conf.gz
To use the example as a template:
# zcat /usr/share/doc/hostapd/examples/hostapd.conf.gz > \
/etc/hostapd/hostapd.conf
# $EDITOR /etc/hostapd/hostapd.conf
To use the initscript method of starting a hostapd daemon see
/etc/default/hostapd.
To use the ifupdown method, the path to hostapd configuration file can
be specified in a network interfaces configuration stanza in
/etc/network/interfaces like so:
iface eth1 inet static
hostapd /etc/hostapd/hostapd.conf
...
The hostapd process will be started in the pre-up phase of ifup, and be
terminated in the post-down phase of ifdown.
-- Kel Modderman <kel@otaku42.de> Tue, 27 Oct 2009 12:03:01 +1000
Please note:
* If you want to use hostapd with a Prism2/2.5/3 card in WPA mode, you'll need
STA firmware version >= 1.7.0.
-- Faidon Liambotis <faidon@cube.gr>, Mon, 10 Oct 2005 14:57:11 +0300
done
zcat /usr/share/doc/hostapd/examples/hostapd.conf.gz > /etc/hostapd/hostapd.conf
或者下载 地址
pi@NanoPC-T4:~$ sudo apt update
Hit:1 http://ports.ubuntu.com bionic InRelease
Hit:2 http://ports.ubuntu.com bionic-backports InRelease
Hit:3 http://ports.ubuntu.com bionic-proposed InRelease
Hit:4 http://ports.ubuntu.com bionic-security InRelease
Hit:5 http://ports.ubuntu.com bionic-updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.
pi@NanoPC-T4:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
u-boot-tools xserver-common xserver-xorg-core xserver-xorg-legacy
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
lnton羚通专注于音视频算法、算力、云平台的高科技人工智能企业。 公司基于视频分析技术、视频智能传输技术、远程监测技术以及智能语音融合技术等, 拥有多款可支持ONVIF、RTSP、GB/T28181等多协议、多路数的音视频智能分析服务器/云平台。