【边缘设备】解决nanoPC-T4 upgrade报错

【问题】

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 <[email protected]>  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 <[email protected]>, 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.

看起来好像可以升级不报错了。不知道后面有没有后遗症。暂时不用科学上网了。

【其他】

ssh 登录 nanoPC-T4

ssh pi@pi_addr  # 例如: [email protected]

然后输入密码 pi。就可以远程访问和操作nanoPC-T4了

Warning: Permanently added '192.168.0.49' (ECDSA) to the list of known hosts.
[email protected]'s password: 
 _____     _                _ _       _____ _     _____ ____ 
|  ___| __(_) ___ _ __   __| | |_   _| ____| |   | ____/ ___|
| |_ | '__| |/ _ \ '_ \ / _` | | | | |  _| | |   |  _|| |  
|  _|| |  | |  __/ | | | (_| | | |_| | |___| |___| |__| |___ 
|_|  |_|  |_|\___|_| |_|\__,_|_|\__, |_____|_____|_____\____|
                                |___/                      

Welcome to Ubuntu 18.04.6 LTS 4.4.179
System load:   0.00            	Up time:       9 min		Local users:   2          
Memory usage:  10 % of 3845Mb 	IP:            192.168.0.49
CPU temp:      42°C         
Usage of /:    44% of 8.2G   

 * Documentation: http://wiki.friendlyarm.com/Ubuntu
 * Forum: http://www.friendlyarm.com/Forum/

To run Qt5 demo, type "qt5demo" at the command prompt and then hit the enter key.
To play a video demo, use command "sudo gst-player.sh".
Last login: Fri Nov 11 08:12:07 2022

pi@NanoPC-T4:~$ ls
demo.mp4  Desktop  Documents  Downloads  h264ify   Music  Pictures  Public  Templates  Videos

远程拷贝和下载资料

scp [email protected]:/usr/share/doc/hostapd/README.Debian /home/john/Documents/

输入密码 pi。就可以下载资料了。

猜你喜欢

转载自blog.csdn.net/zhoujinwang/article/details/127809411#comments_25091715